debug
This commit is contained in:
parent
24f8e86c20
commit
25bd447b16
|
|
@ -6,22 +6,10 @@ import { useWebsocketStore } from '@/stores/websocket';
|
|||
import { onMounted, onBeforeMount } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
|
||||
|
||||
const route = useRoute()
|
||||
const player = usePlayerStore()
|
||||
const game = useGameStore()
|
||||
const bot = useBotStore()
|
||||
|
||||
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 = () => {
|
||||
res = websocket.send({
|
||||
action: 'join',
|
||||
|
|
@ -31,12 +19,20 @@ const join = () => {
|
|||
|
||||
onBeforeMount(() => {
|
||||
console.log(game.owner, game.opponent.id, player.id)
|
||||
if (game.owner == player.id || 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 route = useRoute()
|
||||
const websocket = useWebsocketStore()
|
||||
if (player.id == null) player.initPlayer()
|
||||
websocket.init(route.params.gameId)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user