27 lines
671 B
TypeScript
27 lines
671 B
TypeScript
import { cookies } from "next/headers";
|
|
import { NextResponse } from "next/server";
|
|
import {
|
|
ACCESS_TOKEN,
|
|
AUTH_USER_ID,
|
|
CLAIM_NAME,
|
|
REFRESH_TOKEN,
|
|
} from "@/src/shared/config";
|
|
|
|
export async function POST() {
|
|
const cookieStore = await cookies();
|
|
|
|
const cookieOptions = {
|
|
httpOnly: true,
|
|
sameSite: "lax" as const,
|
|
path: "/",
|
|
maxAge: 0, // 즉시 만료
|
|
};
|
|
|
|
cookieStore.set(ACCESS_TOKEN, "", cookieOptions);
|
|
cookieStore.set(REFRESH_TOKEN, "", cookieOptions);
|
|
cookieStore.set(AUTH_USER_ID, "", cookieOptions);
|
|
cookieStore.set(CLAIM_NAME, "", cookieOptions);
|
|
|
|
return NextResponse.json({ message: "Logged out" }, { status: 200 });
|
|
}
|