diff --git a/layers/components/layouts/Footer.vue b/layers/components/layouts/Footer.vue index 2629ea3..e4630dd 100644 --- a/layers/components/layouts/Footer.vue +++ b/layers/components/layouts/Footer.vue @@ -232,7 +232,21 @@ import type { DevCiConfig, } from '#layers/types/Common' -const { tm, locale }: any = useI18n() +// Configuration +const runtimeConfig = useRuntimeConfig() +const dataResourcesUrl = runtimeConfig.public.dataResourcesUrl as string +const multilingualFileName = 'STOVE_PUBTEMPLATE_homepage_brand_footer.json' + +// Multilingual +const resultGetMultilingual = await useGetMultilingual({ + baseApiUrl: dataResourcesUrl, + fileName: multilingualFileName, +}) +const { tm, locale }: any = useI18n({ + useScope: 'local', + messages: Object(resultGetMultilingual?.value?.multilingual), +}) + // Footer_caution 값이 있고 빈 객체가 아닌지 체크 const hasCautionText = computed(() => { @@ -266,22 +280,25 @@ const footerLinks = computed((): FooterMenuItem[] => { const menu = (tm as any)('Footer_Menu') const menuItems = Array.isArray(menu) ? (menu as FooterMenuItem[]) : [] - // ja일 때 fund_display_yn에 따라 4번째 항목 처리 + // ja일 때 fund_display_yn에 따라 id가 footerFund인 항목 처리 if (locale.value === 'ja') { const fundDisplayYn = footerData.value?.fund_display_yn const fundDisplayUrl = footerData.value?.fund_display_url - // fund_display_yn이 'y'가 아니면 4번째 항목 제거 - if (fundDisplayYn !== 'y') { - return menuItems.filter((_, index) => index !== 3) + // id가 footerFund인 항목의 인덱스 찾기 + const fundIndex = menuItems.findIndex((item: any) => item.id === 'footerFund') + + // fund_display_yn이 'y'가 아니면 id가 footerFund인 항목 제거 + if (!fundDisplayYn) { + return menuItems.filter((item: any) => item.id !== 'footerFund') } - // fund_display_yn이 'y'이면 4번째 항목의 url 설정 - if (fundDisplayYn === 'y' && menuItems[3]) { + // fund_display_yn이 'y'이면 id가 footerFund인 항목의 url 설정 + if (fundDisplayYn && fundIndex !== -1) { const updatedMenuItems = [...menuItems] - updatedMenuItems[3] = { - ...updatedMenuItems[3], - url: fundDisplayUrl || updatedMenuItems[3].url + updatedMenuItems[fundIndex] = { + ...updatedMenuItems[fundIndex], + url: fundDisplayUrl || updatedMenuItems[fundIndex].url } return updatedMenuItems } diff --git a/layers/middleware/pageData.global.ts b/layers/middleware/pageData.global.ts index 29de646..f0c4b5b 100644 --- a/layers/middleware/pageData.global.ts +++ b/layers/middleware/pageData.global.ts @@ -33,6 +33,7 @@ export default defineNuxtRouteMiddleware(async (to, _from) => { // 루트 경로(언어 코드만 있는 경로)로 접근할 때만 intro.page_url로 리다이렉트 const isRootPath = !pageUrl || pageUrl === '' || pageUrl === '/' || pageUrl === `/${langCode}/` + console.log("🚀 ~ isRootPath:", isRootPath) if (isRootPath) { // gameData.intro.page_url이 있으면 해당 URL로 리다이렉트 @@ -145,6 +146,22 @@ export default defineNuxtRouteMiddleware(async (to, _from) => { }) } + if (response?.code === 91002 && response?.message === 'Invalid LangCode') { + //클릭한 주소는 주소표시줄에 표시하도록 수정 + if (import.meta.client) { + window.history.replaceState({}, '', to.path) + } + // 뒤로가기 이동 시 이전 페이지로 이동되도록 수정 + showError( + createError({ + statusCode: 404, + statusMessage: '페이지를 찾을 수 없어요.', + fatal: false, // 즉시 에러 페이지로 + data: { reason: 'post-not-found Invalid LangCode' }, + }) + ) + } + if (response?.code === 91003) { // return navigateTo(`/${langCode}/error`, { external: false }) //클릭한 주소는 주소표시줄에 표시하도록 수정