knowyt/client/src/stores/PlayersStore.ts
Settel 582922a21a bugfix: reset stores when user logs out
bugfix: ignore pending request that do not elong to current game
2022-10-05 08:44:18 +02:00

20 lines
439 B
TypeScript

import { defineStore } from 'pinia'
import { Players } from '@/composables/engine.d';
export const usePlayersStore = defineStore('PlayersStore', {
state: () => {
return {
players: [] as Players,
}
},
actions: {
setPlayers(players: Players): void {
players = players || []
this.players.splice(0, this.players.length, ...players)
},
reset(): void {
this.players.splice(0, 0)
},
},
})