feat: 점검 페이지 추가, external gamedata 호출 추가
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useGameDataStore } from '#layers/stores/useGameDataStore'
|
||||
import type { GameDataRequest, GameDataValue } from '#layers/types/api/gameData'
|
||||
|
||||
export default defineNuxtRouteMiddleware(async (to, _from) => {
|
||||
// 서버 사이드에서는 스킵
|
||||
@@ -6,13 +6,6 @@ export default defineNuxtRouteMiddleware(async (to, _from) => {
|
||||
return
|
||||
}
|
||||
|
||||
const gameDataStore = useGameDataStore()
|
||||
|
||||
// gameData가 로드되지 않았으면 스킵 (다른 미들웨어에서 로드됨)
|
||||
if (!gameDataStore.gameData) {
|
||||
return
|
||||
}
|
||||
|
||||
// 현재 경로에서 언어 코드 추출
|
||||
// 예: /ko/about/story -> ko
|
||||
// 예: /en/test/page -> en
|
||||
@@ -20,8 +13,21 @@ export default defineNuxtRouteMiddleware(async (to, _from) => {
|
||||
const match = to.path.match(languagePattern)
|
||||
const currentLangCode = match ? match[1] : null
|
||||
|
||||
//현재 url에서 게임 도메인만 추출
|
||||
const currentDomain = window.location.hostname;
|
||||
const req: GameDataRequest = {
|
||||
gameDomain: `${currentDomain}`,
|
||||
langCode: `${currentLangCode}`,
|
||||
}
|
||||
const { getGameDataExternal } = useGetGameDataExternal()
|
||||
await getGameDataExternal(req)
|
||||
|
||||
const gameDataStore = useGameDataStore()
|
||||
const gameData = gameDataStore.gameData as GameDataValue
|
||||
const langCodes = gameData?.lang_codes
|
||||
|
||||
// 허용된 언어 코드 목록
|
||||
const allowedLangCodes = gameDataStore.gameData.lang_codes || []
|
||||
const allowedLangCodes = langCodes || []
|
||||
|
||||
// 현재 언어가 허용된 언어 목록에 없으면 에러 페이지로 이동
|
||||
if (currentLangCode && !allowedLangCodes.includes(currentLangCode)) {
|
||||
|
||||
@@ -3,6 +3,7 @@ export default defineNuxtRouteMiddleware(async (to) => {
|
||||
if (import.meta.client) {
|
||||
const gameDataStore = useGameDataStore()
|
||||
const { gameData } = storeToRefs(gameDataStore)
|
||||
console.log("🚀 ~ 00000 gameData:", gameData.value)
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
// const baseDomain = `${config.public.baseDomain}`
|
||||
@@ -15,13 +16,13 @@ export default defineNuxtRouteMiddleware(async (to) => {
|
||||
// })
|
||||
|
||||
const finalLocale = csrGetFinalLocale(to.path)
|
||||
console.log("🚀 ~ finalLocale:", finalLocale)
|
||||
// localeCookie.value = finalLocale.toUpperCase()
|
||||
|
||||
// 웹 점검 -----
|
||||
const { isWebInspection, getInspectionDataExternal } = useGetInspectionDataExternal()
|
||||
await getInspectionDataExternal({ baseApiUrl: stoveApiUrl, gameId: stoveGameId })
|
||||
|
||||
|
||||
// 게임 점검 -----
|
||||
// const { checkGameMaintenance } = useGetGameMaintenance()
|
||||
// await checkGameMaintenance({
|
||||
|
||||
Reference in New Issue
Block a user