Skip to content

Commit

Permalink
fix: error처리 삭제, 이름 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene028 committed Aug 31, 2024
1 parent 9ae85c5 commit 4e91dbb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions apps/admin/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ export const config = {
const middleware = async () => {
const cookieStore = cookies();
const accessToken = cookieStore.get(cookieKey.accessToken)?.value;
const cacheCookie = cookieStore.get(cookieKey["middleware-executed"])?.value;
const middlewareExecuted = cookieStore.get(
cookieKey["middleware-executed"]
)?.value;

if (!accessToken) {
return NextResponse.redirect(new URL("/auth", clientUrl));
}

if (!cacheCookie) {
if (!middlewareExecuted) {
try {
const { manageRole, studyRole } = await dashboardApi.getDashboardInfo();
if (studyRole === "STUDENT" && manageRole === "NONE") {
Expand All @@ -32,7 +34,6 @@ const middleware = async () => {
});
return response;
} catch (error) {
console.log("API 호출 오류 : ", error);
return NextResponse.next();
}
}
Expand Down

0 comments on commit 4e91dbb

Please sign in to comment.