diff --git a/src/components/game/gui/Clock.vue b/src/components/game/gui/Clock.vue index cebb827..3a53e2c 100644 --- a/src/components/game/gui/Clock.vue +++ b/src/components/game/gui/Clock.vue @@ -1,20 +1,18 @@ diff --git a/src/stores/gameStore.ts b/src/stores/gameStore.ts index 97d98b6..75fb55e 100644 --- a/src/stores/gameStore.ts +++ b/src/stores/gameStore.ts @@ -96,8 +96,17 @@ export const useGameStore = defineStore('game', { this.connection.on('reconnect_failed', () => { this.disconnectSocket() }) + + // Listen for new date from socket + this.connection.on('date', (data: Date) => { + this.world.date = new Date(data) + }) }, disconnectSocket() { + // Remove event listeners + this.connection?.off('connect_error') + this.connection?.off('reconnect_failed') + this.connection?.off('date') this.connection?.disconnect() useCookies().remove('token', {