Skip to content

Commit

Permalink
chore: 불필요한 api 호출 에러 처리 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
ghdtjgus76 committed Aug 29, 2024
1 parent 7e42cbb commit 6349ba0
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions apps/client/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,20 @@ const middleware = async (req: NextRequest) => {
}

if (!cacheCookie) {
try {
const { memberRole } = await dashboardApi.getDashboardInfo();
const { memberRole } = await dashboardApi.getDashboardInfo();

if (memberRole !== "REGULAR") {
return NextResponse.redirect(new URL(routePath.auth, req.url));
}

const response = NextResponse.next();
response.cookies.set(cookieKey["middleware-executed"], "true", {
httpOnly: true,
secure: true,
sameSite: "lax",
});
if (memberRole !== "REGULAR") {
return NextResponse.redirect(new URL(routePath.auth, req.url));
}

return response;
} catch (error) {
console.error("API 호출 오류:", error);
const response = NextResponse.next();
response.cookies.set(cookieKey["middleware-executed"], "true", {
httpOnly: true,
secure: true,
sameSite: "lax",
});

return NextResponse.next();
}
return response;
}

return NextResponse.next();
Expand Down

0 comments on commit 6349ba0

Please sign in to comment.