From bfbcd11407c156ffe943e384459fbdd012b36d6e Mon Sep 17 00:00:00 2001 From: fsociety Date: Sun, 29 Sep 2024 21:19:31 +0200 Subject: [PATCH] feat: improve error handling in election views Update error checking in both admin and user election views. Now correctly checks the type of the response object rather than directly comparing with a string. This should provide more accurate error feedback. --- .../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 5602e4e..e86f29d 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][0]) && $response[config('services.relay')][0][0] === 'ERROR') { + if (isset($response[config('services.relay')][0]) && $response[config('services.relay')][0]->getType() === '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 9d0e7df..6b6725d 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][0]) && $response[config('services.relay')][0][0] === 'ERROR') { + if (isset($response[config('services.relay')][0]) && $response[config('services.relay')][0]->getType() === 'ERROR') { abort(500, 'Kann keine Events laden. Nostr Relay antwortet nicht.'); }