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()
? clerkMiddleware(async (auth, req) => {
if (isPublicRoute(req)) return NextResponse.next();
// Clerk middleware auth object supports protect() directly.
auth().protect();
const session = await auth();
session.protect();
return NextResponse.next();
})
: () => NextResponse.next();