From 95637dc20b62a23830bee44121726b84182c7690 Mon Sep 17 00:00:00 2001 From: Aleksandr Zaitsev Date: Sun, 21 Jul 2024 21:17:08 +0300 Subject: [PATCH] fix join process --- src/stores/websocket.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stores/websocket.js b/src/stores/websocket.js index 5771569..1cbc412 100644 --- a/src/stores/websocket.js +++ b/src/stores/websocket.js @@ -12,6 +12,7 @@ export const useWebsocketStore = defineStore("websocket", { init(gameId) { const player = usePlayerStore() const game = useGameStore() + if (game.owner == player.id || game.opponent.id == player.id) window.location.href = window.location.origin + '/lobby/' + game.id this.connection = new WebSocket(connectionUrl + "?gameId=" + gameId + "&playerId=" + player.id); this.connection.onopen = function (event) { console.log(event); @@ -46,7 +47,6 @@ export const useWebsocketStore = defineStore("websocket", { break case 'join': console.log('Recieve join from ' + data.from) - if (game.owner == data.from || game.opponent.id == data.from) window.location.href = window.location.origin + '/lobby/' + game.id if (game.owner != player.id) return // Only owner can process join game.join(data.from) break