fix(proxy): allow anonymous users to visit login and register (#1454)
This commit is contained in:
parent
b4f595a68c
commit
dce211e638
1 changed files with 0 additions and 9 deletions
9
proxy.ts
9
proxy.ts
|
|
@ -1,4 +1,3 @@
|
||||||
import { getSessionCookie } from "better-auth/cookies";
|
|
||||||
import { type NextRequest, NextResponse } from "next/server";
|
import { type NextRequest, NextResponse } from "next/server";
|
||||||
|
|
||||||
export function proxy(request: NextRequest) {
|
export function proxy(request: NextRequest) {
|
||||||
|
|
@ -16,14 +15,6 @@ export function proxy(request: NextRequest) {
|
||||||
return NextResponse.next();
|
return NextResponse.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
const sessionCookie = getSessionCookie(request);
|
|
||||||
|
|
||||||
if (sessionCookie && ["/login", "/register"].includes(pathname)) {
|
|
||||||
const url = request.nextUrl.clone();
|
|
||||||
url.pathname = "/";
|
|
||||||
return NextResponse.redirect(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NextResponse.next();
|
return NextResponse.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue