fix(admin): repair media upload redirect
This commit is contained in:
parent
c35bd5877e
commit
203c94b128
12 changed files with 248 additions and 51 deletions
4
proxy.ts
4
proxy.ts
|
|
@ -7,7 +7,9 @@ export function proxy(request: NextRequest) {
|
|||
if (!pathname.startsWith("/admin") || pathname === "/admin/login") return NextResponse.next();
|
||||
|
||||
if (!request.cookies.get(adminSessionCookie)?.value) {
|
||||
const loginUrl = new URL("/admin/login", request.url);
|
||||
const loginUrl = request.nextUrl.clone();
|
||||
loginUrl.pathname = "/admin/login";
|
||||
loginUrl.search = "";
|
||||
loginUrl.searchParams.set("next", pathname);
|
||||
return NextResponse.redirect(loginUrl);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue