From 177424b220a3e0af9da2ac842c438a1145d7abb6 Mon Sep 17 00:00:00 2001 From: SpacialCircumstances Date: Fri, 22 Nov 2024 19:45:27 +0100 Subject: [PATCH 1/3] Make delete/pause/force start buttons work again --- client/src/views/game/Detail.vue | 91 ---------- client/src/views/game/GameControl.vue | 181 +++++++++++++++----- client/src/views/game/GamePlayerControl.vue | 74 ++++---- 3 files changed, 176 insertions(+), 170 deletions(-) diff --git a/client/src/views/game/Detail.vue b/client/src/views/game/Detail.vue index 064bb1f8f..eccf08ebc 100644 --- a/client/src/views/game/Detail.vue +++ b/client/src/views/game/Detail.vue @@ -92,97 +92,6 @@ export default { this.isLoading = false }, - async pauseGame () { - if (await this.$confirm('Pause game', 'Are you sure you want to pause this game?')) { - this.isLoading = true - - try { - await gameService.pause(this.game._id) - - this.$toast.success(`The game has been paused. Please notify the players.`) - - await this.loadGame() - } catch (err) { - this.errors = err.response.data.errors; - console.error(err) - } - - this.isLoading = false - } - }, - async fastForwardGame () { - if (await this.$confirm('Fast forward game', 'Are you sure you want to fast forward this game?')) { - this.isLoading = true - - try { - await gameService.fastForward(this.game._id) - - this.$toast.success(`The game has been fast forwarded. Please notify the players.`) - - await this.loadGame() - } catch (err) { - this.errors = err.response.data.errors; - console.error(err) - } - - this.isLoading = false - } - }, - async forceStartGame () { - if (await this.$confirm('Force start game', 'All open slots will be filled with bots. Are you sure you want to force start this game?')) { - this.isLoading = true - - try { - await gameService.forceStart(this.game._id) - - this.$toast.success(`The game has been force started. Please notify the players.`) - - await this.loadGame() - } catch (err) { - this.errors = err.response.data.errors; - console.error(this.error); - console.error(err) - } - - this.isLoading = false - } - }, - async resumeGame () { - if (await this.$confirm('Resume game', 'Are you sure you want to resume this game?')) { - this.isLoading = true - - try { - await gameService.resume(this.game._id) - - this.$toast.success(`The game has been resumed. Please notify the players.`) - - await this.loadGame() - } catch (err) { - this.errors = err.response.data.errors; - console.error(err) - } - - this.isLoading = false - } - }, - async deleteGame () { - if (await this.$confirm('Delete game', 'Are you sure you want to delete this game?')) { - this.isLoading = true - - try { - let response = await gameService.delete(this.game._id) - - if (response.status === 200) { - router.push({name: 'main-menu'}) - } - } catch (err) { - this.errors = err.response.data.errors; - console.error(err) - } - - this.isLoading = false - } - } }, computed: { isNewPlayerGame () { diff --git a/client/src/views/game/GameControl.vue b/client/src/views/game/GameControl.vue index 0ceb9d06f..ed78f0501 100644 --- a/client/src/views/game/GameControl.vue +++ b/client/src/views/game/GameControl.vue @@ -1,61 +1,158 @@ diff --git a/client/src/views/game/GamePlayerControl.vue b/client/src/views/game/GamePlayerControl.vue index 150402529..55a860fc5 100644 --- a/client/src/views/game/GamePlayerControl.vue +++ b/client/src/views/game/GamePlayerControl.vue @@ -1,51 +1,51 @@ \ No newline at end of file + From 9fe1198f302fafee56044d280f2a81990b8d92d4 Mon Sep 17 00:00:00 2001 From: SpacialCircumstances Date: Fri, 22 Nov 2024 22:07:30 +0100 Subject: [PATCH 2/3] Fix endless loop on logout --- client/src/store.js | 3 ++- client/src/views/Announcements.vue | 2 +- client/src/views/MainMenu.vue | 2 +- client/src/views/account/Settings.vue | 2 +- client/src/views/admin/AdministrationPage.vue | 2 +- client/src/views/components/ViewContainer.vue | 3 ++- client/src/views/game/ActiveGames.vue | 2 +- client/src/views/game/Create.vue | 2 +- client/src/views/game/Detail.vue | 2 +- client/src/views/game/Leaderboard.vue | 2 +- client/src/views/game/List.vue | 2 +- client/src/views/guild/Create.vue | 2 +- client/src/views/guild/Detail.vue | 2 +- client/src/views/guild/MyGuild.vue | 2 +- client/src/views/guild/Rename.vue | 2 +- client/src/views/shop/Avatars.vue | 2 +- client/src/views/shop/GalacticCredits.vue | 2 +- client/src/views/shop/PurchaseComplete.vue | 2 +- client/src/views/shop/PurchaseFailed.vue | 2 +- 19 files changed, 21 insertions(+), 19 deletions(-) diff --git a/client/src/store.js b/client/src/store.js index 6edf71c26..03c1adb0e 100644 --- a/client/src/store.js +++ b/client/src/store.js @@ -536,10 +536,11 @@ export default createStore({ commit('setUsername', response.data.username) commit('setRoles', response.data.roles) commit('setUserCredits', response.data.credits) + return true; } } - return true; + return false; } catch (err) { console.error(err); return false; diff --git a/client/src/views/Announcements.vue b/client/src/views/Announcements.vue index f3ce129c8..1a60665dd 100644 --- a/client/src/views/Announcements.vue +++ b/client/src/views/Announcements.vue @@ -1,5 +1,5 @@