This commit is contained in:
Aleksandr Zaitsev 2024-07-21 21:28:24 +03:00
parent 66fb5411b4
commit b5aec17dd4
2 changed files with 5 additions and 5 deletions

View File

@ -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);

View File

@ -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')