Refractor socket store into game store

This commit is contained in:
2024-07-12 11:58:06 +02:00
parent 6a1b2dd107
commit 79bef033f3
22 changed files with 161 additions and 170 deletions

View File

@ -32,7 +32,7 @@
import { onMounted, ref } from 'vue'
import { login, register } from '@/services/authentication'
import { useNotificationStore } from '@/stores/notifications'
import { useSocketStore } from '@/stores/socket'
import { useGameStore } from '@/stores/game'
import { useAssetStore } from '@/stores/assets'
const bgm = ref('bgm')
@ -41,7 +41,7 @@ if (bgm.value.paused) {
addEventListener('keydown', () => bgm.value.play())
}
const socket = useSocketStore()
const gameStore = useGameStore()
const notifications = useNotificationStore()
const assetStore = useAssetStore()
const username = ref('')
@ -72,8 +72,8 @@ async function loginFunc() {
return
}
socket.setToken(response.token)
await socket.initConnection()
gameStore.setToken(response.token)
await gameStore.initConnection()
}
async function registerFunc() {
@ -91,7 +91,7 @@ async function registerFunc() {
return
}
socket.setToken(response.token)
await socket.initConnection()
gameStore.setToken(response.token)
await gameStore.initConnection()
}
</script>