Merge branch 'feature/20250206_all' of https://git.sginfra.net/sgp-web-d/web-template-fe into feature/20250206_all
This commit is contained in:
@@ -20,7 +20,7 @@ export default defineNuxtRouteMiddleware(async (to, _from) => {
|
||||
const pageDataStore = usePageDataStore()
|
||||
const loadingStore = useLoadingStore()
|
||||
|
||||
const { langCodes } = storeToRefs(gameDataStore)
|
||||
const { langCodes, defaultLangCode } = storeToRefs(gameDataStore)
|
||||
|
||||
const stoveApiBaseUrl = runtimeConfig.public.stoveApiUrl
|
||||
const accessToken = csrGetAccessToken()
|
||||
@@ -113,7 +113,19 @@ export default defineNuxtRouteMiddleware(async (to, _from) => {
|
||||
}
|
||||
// 91002 (Invalid LangCode): 미지원 언어로 접근
|
||||
if (pageDataResponse?.code === 91002) {
|
||||
return navigateTo(`/${langCode}/home`)
|
||||
// 페이지별 지원 언어에 현재 langCode가 포함되지 않는 경우
|
||||
// 서비스 기본 언어(게임 기본 언어 또는 ko)로 한 번만 리다이렉트
|
||||
const fallbackLang =
|
||||
defaultLangCode.value ||
|
||||
// defaultLangCode가 없으면 ko 우선, 없으면 첫 번째 언어, 그래도 없으면 ko
|
||||
(langCodes.value?.includes('ko') ? 'ko' : langCodes.value?.[0] || 'ko')
|
||||
|
||||
// 이미 fallback 언어로 접근 중이라면 더 이상 리다이렉트하지 않음 (무한 루프 방지)
|
||||
if (langCode === fallbackLang) {
|
||||
return
|
||||
}
|
||||
|
||||
return navigateTo(`/${fallbackLang}/home`)
|
||||
}
|
||||
|
||||
// [TODO]
|
||||
|
||||
Reference in New Issue
Block a user