Refractor socket store into game store
This commit is contained in:
@ -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>
|
||||
|
Reference in New Issue
Block a user