feat: 점검 작업 중
This commit is contained in:
42
layers/middleware/inspection.ts
Normal file
42
layers/middleware/inspection.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
export default defineNuxtRouteMiddleware(async (to) => {
|
||||
try {
|
||||
if (import.meta.client) {
|
||||
const config = useRuntimeConfig()
|
||||
// const baseDomain = `${config.public.baseDomain}`
|
||||
const stoveApiUrl = `${config.public.stoveApiUrl}`
|
||||
console.log("🚀 ~ stoveApiUrl:", stoveApiUrl)
|
||||
// const stoveGameId = `${config.public.stoveGameId}`
|
||||
// const stoveMaintenanceApiUrl = `${config.public.stoveMaintenanceApiUrl}`
|
||||
|
||||
/* const localeCookie = useCookie('LOCALE', {
|
||||
domain: baseDomain
|
||||
}) */
|
||||
|
||||
// const finalLocale = csrGetFinalLocale(to.path)
|
||||
// localeCookie.value = finalLocale.toUpperCase()
|
||||
|
||||
// 웹 점검 -----
|
||||
const { isWebInspection, getInspectionDataExternal } = useGetInspectionDataExternal()
|
||||
await getInspectionDataExternal({ baseApiUrl: stoveApiUrl, gameId: 'STOVE_LORD' })
|
||||
|
||||
// 게임 점검 -----
|
||||
// const { checkGameMaintenance } = useGetGameMaintenance()
|
||||
// await checkGameMaintenance({
|
||||
// baseApiUrl: stoveMaintenanceApiUrl,
|
||||
// category: 'GAME',
|
||||
// service_id1: stoveGameId,
|
||||
// lang: `${finalLocale}`.toLowerCase()
|
||||
// })
|
||||
|
||||
if (isWebInspection.value && !to.path.includes('inspection') && !to.path.includes('api')) {
|
||||
// 점검 중인 경우
|
||||
// return navigateTo(`/${finalLocale}/inspection`, { external: true })
|
||||
} else if (!isWebInspection.value && to.path?.indexOf('inspection') !== -1) {
|
||||
// 점검이 종료된 후 점검 페이지 접근시 메인으로 리다이렉트
|
||||
// return navigateTo(`/${finalLocale}`, { external: true })
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('[Exception] /middleware/inspection: ', e)
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user