fix middleware redirects
All checks were successful
deploy / deploy (push) Successful in 47s

This commit is contained in:
Lee 2023-10-24 11:21:36 +01:00
parent e77e07423a
commit ab3ed98c71

@ -9,10 +9,7 @@ export function middleware(request: NextRequest) {
if (pathname == "/") { if (pathname == "/") {
if (playerIdCookie) { if (playerIdCookie) {
return NextResponse.redirect( return NextResponse.redirect(
new URL( new URL(`/player/${playerIdCookie.value}`, request.url),
`/player/${playerIdCookie.value}/scoresaber/top/1`,
request.url,
),
); );
} else { } else {
return NextResponse.redirect(new URL("/search", request.url)); return NextResponse.redirect(new URL("/search", request.url));
@ -20,7 +17,7 @@ export function middleware(request: NextRequest) {
} }
if (pathname == "/ranking/global") { if (pathname == "/ranking/global") {
return NextResponse.redirect(new URL("/ranking/global/1", request.url)); return NextResponse.redirect(new URL("/ranking/global", request.url));
} }
const requestHeaders = new Headers(request.headers); const requestHeaders = new Headers(request.headers);
requestHeaders.set("x-url", request.url); requestHeaders.set("x-url", request.url);