OmniContent / web /middleware.ts
Ravindra's picture
Upload 15 files
972a622 verified
raw
history blame contribute delete
390 Bytes
import { NextResponse } from "next/server";
import { auth } from "@/auth";
export default auth((req) => {
const isAuthenticated = Boolean(req.auth);
const { pathname } = req.nextUrl;
if (pathname === "/login" && isAuthenticated) {
return NextResponse.redirect(new URL("/", req.nextUrl));
}
return NextResponse.next();
});
export const config = {
matcher: ["/login"],
};