1
0
forked from noxious/client

Removed gmPanel store and moved its logics to gameStore

This commit is contained in:
2024-07-21 20:31:13 +02:00
parent 7445fa42bc
commit e3af9d7acb
5 changed files with 28 additions and 41 deletions

View File

@ -10,12 +10,25 @@ export const useGameStore = defineStore('game', {
token: '' as string | null,
connection: null as Socket | null,
user: null as User | null,
character: null as Character | null
character: null as Character | null,
isGmPanelOpen: false
}),
actions: {
setScreen(screen: string) {
this.screen = screen
},
setToken(token: string) {
this.token = token
},
setUser(user: User | null) {
this.user = user
},
setCharacter(character: Character | null) {
this.character = character
},
toggleGmPanel() {
this.isGmPanelOpen = !this.isGmPanelOpen
},
initConnection() {
this.connection = io(config.server_endpoint, {
secure: !config.development,
@ -49,14 +62,5 @@ export const useGameStore = defineStore('game', {
useCookies().remove('token')
},
setToken(token: string) {
this.token = token
},
setUser(user: User | null) {
this.user = user
},
setCharacter(character: Character | null) {
this.character = character
}
}
})

View File

@ -1,20 +0,0 @@
import { defineStore } from 'pinia'
import type { Character } from '@/types'
import config from '@/config'
export const useGmPanelStore = defineStore('gmPanel', {
state: () => ({
isOpen: false
}),
actions: {
toggle() {
this.isOpen = !this.isOpen
},
open() {
this.isOpen = true
},
close() {
this.isOpen = false
}
}
})