Skip to content

Commit

Permalink
fix: logout user
Browse files Browse the repository at this point in the history
  • Loading branch information
olexh committed Dec 29, 2024
1 parent a31bd04 commit 93503f7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/app/(api)/auth/logout/route.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { cookies } from 'next/headers';
import { NextResponse } from 'next/server';

// export const dynamic = 'force-dynamic';

export async function GET() {
const cookieStore = await cookies();
const response = NextResponse.redirect(`${process.env.SITE_URL}`);

cookieStore.getAll().forEach((cookie) => {
console.log(cookie);
});

cookieStore.delete({
name: 'auth',
Expand All @@ -20,5 +22,5 @@ export async function GET() {
sameSite: 'lax',
});

return response;
return Response.redirect(`${process.env.SITE_URL}`);
}

0 comments on commit 93503f7

Please sign in to comment.