forked from noxious/client
Fixed modal fullscreen icons, made types compatible with server changes made for #174, npm update, npm run format, minor improvements
This commit is contained in:
@ -1,17 +1,17 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import type { ExtendedCharacter, Zone } from '@/types'
|
||||
import type { ZoneCharacter, Zone } from '@/types'
|
||||
|
||||
export const useZoneStore = defineStore('zone', {
|
||||
state: () => {
|
||||
return {
|
||||
zone: null as Zone | null,
|
||||
characters: [] as ExtendedCharacter[],
|
||||
characters: [] as ZoneCharacter[],
|
||||
characterLoaded: false
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
getCharacterById: (state) => {
|
||||
return (id: number) => state.characters.find((char) => char.id === id)
|
||||
return (id: number) => state.characters.find((char) => char.character.id === id)
|
||||
},
|
||||
getCharacterCount: (state) => {
|
||||
return state.characters.length
|
||||
@ -24,20 +24,18 @@ export const useZoneStore = defineStore('zone', {
|
||||
setZone(zone: Zone | null) {
|
||||
this.zone = zone
|
||||
},
|
||||
setCharacters(characters: ExtendedCharacter[]) {
|
||||
setCharacters(characters: ZoneCharacter[]) {
|
||||
this.characters = characters
|
||||
},
|
||||
addCharacter(character: ExtendedCharacter) {
|
||||
addCharacter(character: ZoneCharacter) {
|
||||
this.characters.push(character)
|
||||
},
|
||||
updateCharacter(updatedCharacter: ExtendedCharacter) {
|
||||
const index = this.characters.findIndex((char) => char.id === updatedCharacter.id)
|
||||
if (index !== -1) {
|
||||
this.characters[index] = { ...this.characters[index], ...updatedCharacter }
|
||||
}
|
||||
updateCharacter(updatedCharacter: ZoneCharacter) {
|
||||
const index = this.characters.findIndex((char) => char.character.id === updatedCharacter.character.id)
|
||||
if (index !== -1) this.characters[index] = updatedCharacter
|
||||
},
|
||||
removeCharacter(character_id: number) {
|
||||
this.characters = this.characters.filter((char) => char.id !== character_id)
|
||||
removeCharacter(characterId: number) {
|
||||
this.characters = this.characters.filter((char) => char.character.id !== characterId)
|
||||
},
|
||||
setCharacterLoaded(loaded: boolean) {
|
||||
this.characterLoaded = loaded
|
||||
|
Reference in New Issue
Block a user