debug
This commit is contained in:
parent
b5aec17dd4
commit
49b1b9bd13
|
|
@ -12,26 +12,31 @@ const player = usePlayerStore()
|
||||||
const game = useGameStore()
|
const game = useGameStore()
|
||||||
const bot = useBotStore()
|
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')
|
|
||||||
localStorage.removeItem('bot')
|
|
||||||
|
|
||||||
const websocket = useWebsocketStore()
|
|
||||||
if (player.id == null) player.initPlayer()
|
|
||||||
websocket.init(route.params.gameId)
|
|
||||||
|
|
||||||
const join = () => {
|
const join = () => {
|
||||||
res = websocket.send({
|
res = websocket.send({
|
||||||
action: 'join',
|
action: 'join',
|
||||||
from: player.id
|
from: player.id
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
console.log(game.owner, game.opponent.id, player.id)
|
||||||
|
if (game.owner == player.id || game.opponent.id == player.id) {
|
||||||
|
window.location.href = window.location.origin + '/lobby/' + game.id
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
game.$reset()
|
||||||
|
bot.$reset()
|
||||||
|
localStorage.removeItem('game')
|
||||||
|
localStorage.removeItem('bot')
|
||||||
|
|
||||||
|
const websocket = useWebsocketStore()
|
||||||
|
if (player.id == null) player.initPlayer()
|
||||||
|
websocket.init(route.params.gameId)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user