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.
This commit is contained in:
fsociety
2024-09-29 21:21:34 +02:00
parent bfbcd11407
commit 58f35bd8d6
2 changed files with 2 additions and 2 deletions
@@ -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.');
}
@@ -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.');
}