From 58f35bd8d6ed3c00ee6a908848d21cc099c0a0e7 Mon Sep 17 00:00:00 2001 From: fsociety Date: Sun, 29 Sep 2024 21:21:34 +0200 Subject: [PATCH] feat: add additional error check in association election views The association election admin and user views now perform an additional check to ensure the relay service is responding correctly. This should prevent unexpected crashes when the service is unavailable or returning errors. --- .../views/pages/association/election/[Election:year].blade.php | 2 +- .../pages/association/election/admin/[Election:year].blade.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/pages/association/election/[Election:year].blade.php b/resources/views/pages/association/election/[Election:year].blade.php index e86f29d..68bfe9c 100644 --- a/resources/views/pages/association/election/[Election:year].blade.php +++ b/resources/views/pages/association/election/[Election:year].blade.php @@ -95,7 +95,7 @@ $loadEvents = function () { $response = $request->send(); // Check for errors in the response - if (isset($response[config('services.relay')][0]) && $response[config('services.relay')][0]->getType() === 'ERROR') { + if (isset($response[config('services.relay')][0]) && isset($response[config('services.relay')][0][0]) && $response[config('services.relay')][0][0] === 'ERROR') { abort(500, 'Kann keine Events laden. Nostr Relay antwortet nicht.'); } diff --git a/resources/views/pages/association/election/admin/[Election:year].blade.php b/resources/views/pages/association/election/admin/[Election:year].blade.php index 6b6725d..06a8526 100644 --- a/resources/views/pages/association/election/admin/[Election:year].blade.php +++ b/resources/views/pages/association/election/admin/[Election:year].blade.php @@ -135,7 +135,7 @@ $loadEvents = function () { $response = $request->send(); // Check for errors in the response - if (isset($response[config('services.relay')][0]) && $response[config('services.relay')][0]->getType() === 'ERROR') { + if (isset($response[config('services.relay')][0]) && isset($response[config('services.relay')][0][0]) && $response[config('services.relay')][0][0] === 'ERROR') { abort(500, 'Kann keine Events laden. Nostr Relay antwortet nicht.'); }