refactor. 게임 데이터 로딩 및 언어 전환 로직 개선
- LanguageSwitcher.vue에서 setLocale 및 gameData 로딩 로직 통합 - useGameDataLoader.ts 추가로 게임 데이터 로딩 기능 구현 - init.route.global.ts에서 초기화 로직 개선 및 중복 호출 방지 - useGameDataStore.ts에 currentLangCode 상태 추가 및 설정 함수 구현 Made-with: Cursor
This commit is contained in:
@@ -9,6 +9,7 @@ export const useGameDataStore = defineStore('gameData', () => {
|
||||
stoveGnbJson: null as GameDataValue['stove_gnb_json'] | null,
|
||||
langCodes: null as GameDataValue['lang_codes'] | null,
|
||||
defaultLangCode: null as GameDataValue['default_lang_code'] | null,
|
||||
currentLangCode: null as string | null,
|
||||
gaCode: null as GameDataValue['ga_code'] | null,
|
||||
platformType: null as GameDataValue['platform_type'] | null,
|
||||
osType: null as GameDataValue['os_type'] | null,
|
||||
@@ -55,6 +56,10 @@ export const useGameDataStore = defineStore('gameData', () => {
|
||||
state.eventBanner = data?.event_banner
|
||||
}
|
||||
|
||||
const setCurrentLangCode = (langCode: string | null) => {
|
||||
state.currentLangCode = langCode ? `${langCode}`.toLowerCase() : null
|
||||
}
|
||||
|
||||
const clearGameData = () => {
|
||||
Object.assign(state, getInitialState())
|
||||
}
|
||||
@@ -62,6 +67,7 @@ export const useGameDataStore = defineStore('gameData', () => {
|
||||
return {
|
||||
...toRefs(state),
|
||||
setGameData,
|
||||
setCurrentLangCode,
|
||||
clearGameData,
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user