28 lines
675 B
TypeScript
28 lines
675 B
TypeScript
import type { GameDataValue } from '#layers/types/api/gameData'
|
|
|
|
export const useGameDataStore = defineStore('gameData', () => {
|
|
const gameData = ref<GameDataValue | null>(null)
|
|
const langCodes = ref<string[] | null>(null)
|
|
const defaultLangCode = ref<string | null>(null)
|
|
|
|
const setGameData = (data: GameDataValue) => {
|
|
gameData.value = data
|
|
langCodes.value = data.lang_codes
|
|
defaultLangCode.value = data.default_lang_code
|
|
}
|
|
|
|
const clearGameData = () => {
|
|
gameData.value = null
|
|
langCodes.value = null
|
|
defaultLangCode.value = null
|
|
}
|
|
|
|
return {
|
|
gameData,
|
|
langCodes,
|
|
defaultLangCode,
|
|
setGameData,
|
|
clearGameData,
|
|
}
|
|
})
|