Minor improvement

This commit is contained in:
Dennis Postma 2024-09-29 16:07:55 +02:00
parent df3b9db45d
commit 1f46b94441
3 changed files with 57 additions and 51 deletions

View File

@ -5,7 +5,8 @@ import config from '@/config'
import { useCookies } from '@vueuse/integrations/useCookies' import { useCookies } from '@vueuse/integrations/useCookies'
export const useGameStore = defineStore('game', { export const useGameStore = defineStore('game', {
state: () => ({ state: () => {
return {
notifications: [] as Notification[], notifications: [] as Notification[],
assets: [] as Asset[], assets: [] as Asset[],
token: '' as string | null, token: '' as string | null,
@ -21,7 +22,8 @@ export const useGameStore = defineStore('game', {
isUserPanelOpen: false, isUserPanelOpen: false,
isGmPanelOpen: false isGmPanelOpen: false
} }
}), }
},
getters: { getters: {
getNotifications: (state: any) => state.notifications, getNotifications: (state: any) => state.notifications,
getAssetByKey: (state) => { getAssetByKey: (state) => {

View File

@ -10,7 +10,8 @@ type TeleportSettings = {
} }
export const useZoneEditorStore = defineStore('zoneEditor', { export const useZoneEditorStore = defineStore('zoneEditor', {
state: () => ({ state: () => {
return {
active: false, active: false,
zone: null as Zone | null, zone: null as Zone | null,
tool: 'move', tool: 'move',
@ -40,7 +41,8 @@ export const useZoneEditorStore = defineStore('zoneEditor', {
toPositionY: 0, toPositionY: 0,
toRotation: 0 toRotation: 0
} }
}), }
},
actions: { actions: {
toggleActive() { toggleActive() {
const gameStore = useGameStore() const gameStore = useGameStore()

View File

@ -2,11 +2,13 @@ import { defineStore } from 'pinia'
import type { ExtendedCharacter, Zone } from '@/types' import type { ExtendedCharacter, Zone } from '@/types'
export const useZoneStore = defineStore('zone', { export const useZoneStore = defineStore('zone', {
state: () => ({ state: () => {
return {
zone: null as Zone | null, zone: null as Zone | null,
characters: [] as ExtendedCharacter[], characters: [] as ExtendedCharacter[],
characterLoaded: false characterLoaded: false
}), }
},
getters: { getters: {
getCharacterById: (state) => { getCharacterById: (state) => {
return (id: number) => state.characters.find((char) => char.id === id) return (id: number) => state.characters.find((char) => char.id === id)