261102_01_ENH: 프로젝트 접근 권한 확인 및 탭별 선택 상태 분리, 공용 인증 쿠키 설정

This commit is contained in:
2026-11-02 15:14:08 +09:00
parent 4bfa2af213
commit 69939f8d2b
18 changed files with 336 additions and 53 deletions

View File

@@ -1,5 +1,6 @@
import { apiError, createHttpClient, redirectToLogout } from "@kri/common/http";
import { clientEnv } from "@/lib/env.client";
import { announceProjectAccess, projectFromRequest } from "@/lib/project-access";
const resolveBaseUrl = () =>
typeof window === "undefined"
@@ -8,7 +9,14 @@ const resolveBaseUrl = () =>
export const nextApi = createHttpClient(resolveBaseUrl(), {
onForbidden: (error) => {
if (apiError(error).code === "EXTERNAL_SCOPE_DENIED") redirectToLogout();
const info = apiError(error);
if (info.code === "EXTERNAL_SCOPE_DENIED" || info.code === "PROJECT_IDENTITY_REQUIRED") {
redirectToLogout();
return;
}
const project = projectFromRequest(error.url);
if (info.code === "PROJECT_ACCESS_DENIED" && project && !new URL(error.url).pathname.endsWith("/access"))
announceProjectAccess({ project, allowed: false, message: info.message });
},
onResponseError: false,
});