diff --git a/src/screens/Login.vue b/src/screens/Login.vue index 16a122c..f1c51dd 100644 --- a/src/screens/Login.vue +++ b/src/screens/Login.vue @@ -33,6 +33,7 @@ import { login, register } from '@/services/authentication' import { useNotificationStore } from '@/stores/notifications' import { useGameStore } from '@/stores/game' import { useAssetStore } from '@/stores/assets' +import { useCookies } from '@vueuse/integrations/useCookies' const gameStore = useGameStore() const notifications = useNotificationStore() @@ -45,6 +46,13 @@ onMounted(async () => { /** * Fetch assets from the server */ + + const token = useCookies().get('token'); + if(token) { + gameStore.setToken(token); + gameStore.initConnection() + } + if (!(await assetStore.fetchAssets())) { notifications.addNotification({ message: 'Failed to fetch assets, the server may be offline or in maintenance. Please try again later.' }) }