fix. gameData 개별 속성 구조분해

This commit is contained in:
clkim
2026-01-13 18:07:43 +09:00
parent 7e98721228
commit 79b9d71aa3
17 changed files with 104 additions and 117 deletions

View File

@@ -9,22 +9,22 @@ export default defineNuxtRouteMiddleware(to => {
if (to.path.includes('inspection')) return
const gameDataStore = useGameDataStore()
const { gameData } = storeToRefs(gameDataStore)
const { langCodes, intro } = storeToRefs(gameDataStore)
// app.vue에서 설정한 스토어 값이 없으면 대기
if (!gameData.value) return
if (!langCodes.value || !intro.value) return
// -------------------------------------------------------------------------------
// [Home Redirect]
// -------------------------------------------------------------------------------
const gamePath = getPathAfterLanguage(to.path)
const langCode = csrGetFinalLocale(to.path, gameData.value.lang_codes)
const langCode = csrGetFinalLocale(to.path, langCodes.value)
const isRootPath = gamePath === '' || gamePath === '/'
if (isRootPath) {
// gameData.intro.page_url이 있으면 해당 URL로 리다이렉트, 없으면 /home으로
const introPageUrl = gameData.value?.intro?.page_url
// intro.page_url이 있으면 해당 URL로 리다이렉트, 없으면 /home으로
const introPageUrl = intro.value?.page_url
const redirectPath = getIntroRedirectPath(
introPageUrl,
langCode,