diff --git a/src/stores/websocket.js b/src/stores/websocket.js index 7d26421..68e2881 100644 --- a/src/stores/websocket.js +++ b/src/stores/websocket.js @@ -12,11 +12,6 @@ export const useWebsocketStore = defineStore("websocket", { init(gameId) { const player = usePlayerStore() const game = useGameStore() - console.log(game, game.opponent.id, player.id) - if (window.location.pathname != '/lobby/' + game.id && (game.owner == player.id || game.opponent.id == player.id)) { - window.location.href = window.location.origin + '/lobby/' + game.id - return - } this.connection = new WebSocket(connectionUrl + "?gameId=" + gameId + "&playerId=" + player.id); this.connection.onopen = function (event) { console.log(event); diff --git a/src/views/JoinView.vue b/src/views/JoinView.vue index c381dec..1305d8c 100644 --- a/src/views/JoinView.vue +++ b/src/views/JoinView.vue @@ -12,6 +12,11 @@ const player = usePlayerStore() const game = useGameStore() const bot = useBotStore() +if (game.owner == player.id || game.opponent.id == player.id) { + window.location.href = window.location.origin + '/lobby/' + game.id + return +} + game.$reset() bot.$reset() localStorage.removeItem('game')