Skip to content

Commit

Permalink
Fix error on corrupt session logout
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-sherman committed Sep 25, 2024
1 parent 743bcac commit 6cd1506
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/frontpage/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
signOut,
} from "./lib/auth";

export async function middleware(_request: NextRequest) {
export async function middleware(request: NextRequest) {
const session = await getSession();
if (!session) {
return NextResponse.next();
Expand Down Expand Up @@ -92,7 +92,7 @@ export async function middleware(_request: NextRequest) {
// Logout and show error
console.log("session corrupt, logging out", result);
await signOut();
const response = NextResponse.redirect("/login");
const response = NextResponse.redirect(new URL("/login", request.url));
deleteAuthCookie(response.cookies);
return response;
}
Expand Down

0 comments on commit 6cd1506

Please sign in to comment.