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 { onMounted, onBeforeMount } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const route = useRoute()
|
|
||||||
const player = usePlayerStore()
|
const player = usePlayerStore()
|
||||||
const game = useGameStore()
|
const game = useGameStore()
|
||||||
const bot = useBotStore()
|
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 = () => {
|
const join = () => {
|
||||||
res = websocket.send({
|
res = websocket.send({
|
||||||
action: 'join',
|
action: 'join',
|
||||||
|
|
@ -31,12 +19,20 @@ const join = () => {
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
console.log(game.owner, game.opponent.id, player.id)
|
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
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user