From 4eaa35584d891b369f3627df0de7b07f7409edca Mon Sep 17 00:00:00 2001 From: starnakin Date: Thu, 21 Dec 2023 00:23:10 +0100 Subject: [PATCH] fix: return 404 when tournament not found --- frontend/static/js/api/tournament/tournament.js | 2 +- frontend/static/js/api/tournament/tournaments.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/static/js/api/tournament/tournament.js b/frontend/static/js/api/tournament/tournament.js index 141ae57..c33da46 100644 --- a/frontend/static/js/api/tournament/tournament.js +++ b/frontend/static/js/api/tournament/tournament.js @@ -37,7 +37,7 @@ class Tourmanent let response = await this.client._get(`/api/tournaments/${id}`); if (response.status === 404) - return null; + return 1; let response_data = await response.json(); diff --git a/frontend/static/js/api/tournament/tournaments.js b/frontend/static/js/api/tournament/tournaments.js index 8424500..3383cd5 100644 --- a/frontend/static/js/api/tournament/tournaments.js +++ b/frontend/static/js/api/tournament/tournaments.js @@ -17,7 +17,8 @@ class Tourmanents async getTournament(id) { let tournament = new Tourmanent(this.client); - await tournament.init(id); + if (await tournament.init(id)) + return null; return tournament; }