[SSR 비활성화] SPA 방식으로 변경
This commit is contained in:
@@ -1,8 +1,4 @@
|
|||||||
export default async function useOverlay() {
|
export default async function useOverlay() {
|
||||||
if (import.meta.server) {
|
// SPA 모드에서는 항상 클라이언트에서만 실행됨
|
||||||
// SSR에서는 cytoscape-overlays를 사용하지 않음
|
return await import("cytoscape-overlays");
|
||||||
return null
|
|
||||||
}
|
|
||||||
// 전체 export 객체를 반환
|
|
||||||
return await import('cytoscape-overlays')
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
export default defineNuxtRouteMiddleware(async (to, _from) => {
|
export default defineNuxtRouteMiddleware(async (to, _from) => {
|
||||||
if (import.meta.client) {
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const { hasPagePermission } = usePermission();
|
const { hasPagePermission } = usePermission();
|
||||||
|
|
||||||
@@ -28,5 +27,4 @@ export default defineNuxtRouteMiddleware(async (to, _from) => {
|
|||||||
return navigateTo("/");
|
return navigateTo("/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
compatibilityDate: "2025-05-15",
|
ssr: false,
|
||||||
devtools: { enabled: true },
|
devtools: { enabled: true },
|
||||||
modules: [
|
modules: [
|
||||||
"@nuxt/eslint",
|
"@nuxt/eslint",
|
||||||
@@ -36,7 +36,7 @@ export default defineNuxtConfig({
|
|||||||
shim: false,
|
shim: false,
|
||||||
strict: true,
|
strict: true,
|
||||||
},
|
},
|
||||||
plugins: ["~/plugins/vue3-tui-grid.client.ts"],
|
plugins: ["~/plugins/vue3-tui-grid.ts"],
|
||||||
components: [
|
components: [
|
||||||
{ path: "~/components/base", pathPrefix: false }, // @base/ 접두사 제거
|
{ path: "~/components/base", pathPrefix: false }, // @base/ 접두사 제거
|
||||||
{ path: "~/components/layout", pathPrefix: false }, // @layout/ 접두사 제거
|
{ path: "~/components/layout", pathPrefix: false }, // @layout/ 접두사 제거
|
||||||
|
|||||||
@@ -19,18 +19,6 @@ export default defineNuxtPlugin(() => {
|
|||||||
...(isFormData ? {} : { "Content-Type": "application/json" }),
|
...(isFormData ? {} : { "Content-Type": "application/json" }),
|
||||||
...(options.headers || {}),
|
...(options.headers || {}),
|
||||||
};
|
};
|
||||||
|
|
||||||
// 3) SSR 쿠키 포워딩
|
|
||||||
if (import.meta.server) {
|
|
||||||
const cookie = useRequestHeaders(["cookie"])?.cookie;
|
|
||||||
const reqUrl = String(request);
|
|
||||||
const isBackendApi =
|
|
||||||
!reqUrl.startsWith("http") || reqUrl.startsWith(baseURL);
|
|
||||||
|
|
||||||
if (cookie && isBackendApi) {
|
|
||||||
options.headers = { ...(options.headers || {}), cookie } as any;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onResponseError({ response }) {
|
onResponseError({ response }) {
|
||||||
// 공통 로깅
|
// 공통 로깅
|
||||||
|
|||||||
Reference in New Issue
Block a user