Fix database session redirect loop
This commit is contained in:
@@ -1,15 +0,0 @@
|
|||||||
import { NextResponse } from "next/server";
|
|
||||||
import { auth } from "@/lib/auth";
|
|
||||||
|
|
||||||
export default auth((req) => {
|
|
||||||
const isApp = req.nextUrl.pathname.startsWith("/app");
|
|
||||||
if (isApp && !req.auth) {
|
|
||||||
const url = new URL("/signin", req.url);
|
|
||||||
url.searchParams.set("from", req.nextUrl.pathname);
|
|
||||||
return NextResponse.redirect(url);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export const config = {
|
|
||||||
matcher: ["/app/:path*"],
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user