import { defineStore } from 'pinia' export type Gameinfo = { id: string name: string state: string phase: string } export const useGameinfoStore = defineStore('GameinfoStore', { state: () => { return { gameInfo: { id: '', name: '', state: '', phase: '', } as Gameinfo, } }, getters: { id: (state): string => state.gameInfo.id, name: (state): string => state.gameInfo.name, state: (state): string => state.gameInfo.state, phase: (state): string => state.gameInfo.phase, isCollect: (state): boolean => state.gameInfo.state === 'collect', isIdle: (state): boolean => state.gameInfo.state === 'idle', isReadySet: (state): boolean => state.gameInfo.state === 'ready-set', isPlay: (state): boolean => state.gameInfo.state === 'play', isFinal: (state): boolean => state.gameInfo.state === 'final', }, actions: { setGameinfo(gameInfo: Gameinfo): void { this.gameInfo = gameInfo }, }, })