fix(entry): add entry
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { NextRequest, NextResponse } from "next/server"
|
||||
import { cookies } from "next/headers"
|
||||
import { NextRequest, NextResponse } from "next/server"
|
||||
|
||||
const publicRoutes = ["/login", "/"]
|
||||
|
||||
@@ -35,22 +35,24 @@ export default async function middleware(req: NextRequest) {
|
||||
console.log("Lark environment detected, redirecting with auto login")
|
||||
return NextResponse.redirect(
|
||||
new URL(
|
||||
`${process.env.NEXT_PUBLIC_BASE_PATH}/login?auto=true`,
|
||||
// `${process.env.NEXT_PUBLIC_BASE_PATH}/login?auto=true`,
|
||||
`/login?auto=true`,
|
||||
req.nextUrl
|
||||
)
|
||||
)
|
||||
} else {
|
||||
return NextResponse.redirect(
|
||||
new URL(`${process.env.NEXT_PUBLIC_BASE_PATH}/login`, req.nextUrl)
|
||||
// new URL(`${process.env.NEXT_PUBLIC_BASE_PATH}/login`, req.nextUrl)
|
||||
new URL(`/login`, req.nextUrl)
|
||||
)
|
||||
}
|
||||
}
|
||||
// 5. Redirect to /dashboard if the user is authenticated
|
||||
if (isPublicRoute && session && !path.startsWith("/management")) {
|
||||
return NextResponse.redirect(
|
||||
new URL(`${process.env.NEXT_PUBLIC_BASE_PATH}/management`, req.nextUrl)
|
||||
)
|
||||
}
|
||||
// if (isPublicRoute && session && !path.startsWith("/management")) {
|
||||
// return NextResponse.redirect(
|
||||
// new URL(`${process.env.NEXT_PUBLIC_BASE_PATH}/management`, req.nextUrl)
|
||||
// )
|
||||
// }
|
||||
|
||||
return NextResponse.next()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user