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.
This commit is contained in:
fsociety
2024-09-29 21:19:31 +02:00
parent 5ad40f8214
commit bfbcd11407
2 changed files with 2 additions and 2 deletions

View File

@@ -95,7 +95,7 @@ $loadEvents = function () {
$response = $request->send(); $response = $request->send();
// Check for errors in the response // 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.'); abort(500, 'Kann keine Events laden. Nostr Relay antwortet nicht.');
} }

View File

@@ -135,7 +135,7 @@ $loadEvents = function () {
$response = $request->send(); $response = $request->send();
// Check for errors in the response // 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.'); abort(500, 'Kann keine Events laden. Nostr Relay antwortet nicht.');
} }