fix(frontend): satisfy Clerk auth() types in middleware
Avoid calling protect() on a Promise by awaiting auth() first.
This commit is contained in:
@@ -14,7 +14,8 @@ const isPublicRoute = createRouteMatcher(["/sign-in(.*)"]);
|
||||
export default isClerkEnabled()
|
||||
? clerkMiddleware(async (auth, req) => {
|
||||
if (isPublicRoute(req)) return NextResponse.next();
|
||||
await auth().protect();
|
||||
const session = await auth();
|
||||
session.protect();
|
||||
return NextResponse.next();
|
||||
})
|
||||
: () => NextResponse.next();
|
||||
|
||||
Reference in New Issue
Block a user