Spaces:
Running
Running
| 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"], | |
| }; | |