diff --git a/src/app/api/logout/route.ts b/src/app/api/logout/route.ts index 999f1e7..5b8b739 100644 --- a/src/app/api/logout/route.ts +++ b/src/app/api/logout/route.ts @@ -4,11 +4,15 @@ import { NextResponse } from 'next/server'; export async function POST() { const cookieStore = await cookies(); - // Clear admin session + // Clear both admin and customer sessions + // Must delete with same options they were set with cookieStore.delete('adminSession'); - - // Clear customer session cookieStore.delete('session'); - return NextResponse.json({ success: true }); + // Also send response with Set-Cookie headers to ensure deletion + const response = NextResponse.json({ success: true }); + response.headers.set('Set-Cookie', 'adminSession=; Path=/; Max-Age=0; HttpOnly'); + response.headers.append('Set-Cookie', 'session=; Path=/; Max-Age=0; HttpOnly'); + + return response; }