Skip to content

Commit ade5e85

Browse files
committed
feat: enhance logout API to include cookies for access and refresh tokens
1 parent cca59fb commit ade5e85

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

apps/ticket/src/app/api/logout/route.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { cookies } from "next/headers";
12
import { NextResponse } from "next/server";
23

34
import { API_URL } from "@/data/constants";
@@ -6,9 +7,14 @@ import { API_URL } from "@/data/constants";
67
* 로그아웃 요청 API
78
*/
89
export async function POST(req: Request) {
10+
const cookiesStore = await cookies();
11+
912
const apiRes = await fetch(process.env.NEXT_PUBLIC_TICKET_API_BASE_URL + API_URL.USER.LOGOUT, {
1013
method: "POST",
11-
headers: { "Content-Type": "application/json" },
14+
headers: {
15+
"Content-Type": "application/json",
16+
Cookie: `accessToken=${cookiesStore.get("accessToken")?.value}; refreshToken=${cookiesStore.get("refreshToken")?.value}`,
17+
},
1218
credentials: "include",
1319
});
1420

0 commit comments

Comments
 (0)