fix(frontend): await auth() before protect

Fix TS2339 by awaiting Clerk auth() (returns Promise<SessionAuthWithRedirect>) before calling protect().
This commit is contained in:
Arjun (OpenClaw)
2026-02-07 19:55:29 +00:00
parent fce12698d8
commit ed2556c871

View File

@@ -14,8 +14,8 @@ const isPublicRoute = createRouteMatcher(["/sign-in(.*)"]);
export default isClerkEnabled() export default isClerkEnabled()
? clerkMiddleware(async (auth, req) => { ? clerkMiddleware(async (auth, req) => {
if (isPublicRoute(req)) return NextResponse.next(); if (isPublicRoute(req)) return NextResponse.next();
// Clerk middleware auth object supports protect() directly. const session = await auth();
auth().protect(); session.protect();
return NextResponse.next(); return NextResponse.next();
}) })
: () => NextResponse.next(); : () => NextResponse.next();