Skip to content

Commit

Permalink
fix: 어드민 전용으로 쿠키 이름 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene028 committed Sep 1, 2024
1 parent fc07a30 commit 757943c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/admin/constants/cookieKey.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const enum cookieKey {
accessToken = "accessToken",
"middleware-executed" = "middleware-executed",
"admin-middleware-executed" = "admin-middleware-executed",
}
4 changes: 2 additions & 2 deletions apps/admin/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const middleware = async () => {
const cookieStore = cookies();
const accessToken = cookieStore.get(cookieKey.accessToken)?.value;
const middlewareExecuted = cookieStore.get(
cookieKey["middleware-executed"]
cookieKey["admin-middleware-executed"]
)?.value;

if (!accessToken) {
Expand All @@ -26,7 +26,7 @@ const middleware = async () => {
return NextResponse.redirect(new URL("/auth", clientUrl));
}
const response = NextResponse.next();
response.cookies.set(cookieKey["middleware-executed"], "true", {
response.cookies.set(cookieKey["admin-middleware-executed"], "true", {
httpOnly: true,
secure: true,
sameSite: "lax",
Expand Down

0 comments on commit 757943c

Please sign in to comment.