refactor: 언어 정책 쿠키 i18n에서 설정, gameData External 제거

This commit is contained in:
“hyeonggkim”
2025-11-13 18:46:03 +09:00
parent 4698efc225
commit 4b7ccd8f4f
7 changed files with 98 additions and 83 deletions

View File

@@ -186,7 +186,7 @@ const switchLanguage = async () => {
maxAge: 60 * 60 * 24 * 365, // 1년 (초 단위)
sameSite: 'lax',
})
localeCookie.value = selectedLocale.value.toUpperCase()
localeCookie.value = selectedLocale.value.toLowerCase()
// 페이지 데이터 초기화 (새로운 언어로 다시 로드되도록)
pageDataStore.clearPageData()

View File

@@ -1,7 +1,8 @@
<script setup lang="ts">
import type { GameDataValue } from '#layers/types/api/gameData'
let mountedInstance: any = null
const runtimeConfig = useRuntimeConfig()
const baseDomain = `${runtimeConfig.public.baseDomain}`
onMounted(() => {
const gameDataStore = useGameDataStore()
const gameData = gameDataStore.gameData as GameDataValue
@@ -15,7 +16,7 @@ onMounted(() => {
if (typeof window !== 'undefined' && (window as any).StoveGnb) {
const stoveGnbOptions = {
logArea: currentDomain,
useLanguageCodeFromPath: true,
useLanguageCodeFromPath: false,
serviceTitle: {
pc: '',
mobile: '',
@@ -53,8 +54,22 @@ onMounted(() => {
stoveGnbOptions
)
}
if(mountedInstance){
//Stove GNB에서도 쿠키를 굽고 있어 소문자로 통일
//LOCALE 쿠키를 가져온 후 소문자로 변경해서 다시 LOCALE 쿠키를 설정
nextTick(() => {
const localeCookie = useCookie('LOCALE', {
domain: baseDomain,
path: '/',
maxAge: 60 * 60 * 24 * 365, // 1년 (초 단위)
})
localeCookie.value = localeCookie.value.toLowerCase()
})
}
})
onBeforeUnmount(() => {
if (mountedInstance && typeof mountedInstance.destroy === 'function') {
mountedInstance.destroy()