fix. gameData 개별 속성 구조분해
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user