fix(frontend): await auth().protect in middleware
Clerk middleware auth() is async in current types; await protect() to satisfy TS and avoid runtime issues.
This commit is contained in:
@@ -12,9 +12,9 @@ const isClerkEnabled = () =>
|
|||||||
const isPublicRoute = createRouteMatcher(["/sign-in(.*)"]);
|
const isPublicRoute = createRouteMatcher(["/sign-in(.*)"]);
|
||||||
|
|
||||||
export default isClerkEnabled()
|
export default isClerkEnabled()
|
||||||
? clerkMiddleware((auth, req) => {
|
? clerkMiddleware(async (auth, req) => {
|
||||||
if (isPublicRoute(req)) return NextResponse.next();
|
if (isPublicRoute(req)) return NextResponse.next();
|
||||||
auth().protect();
|
await auth().protect();
|
||||||
return NextResponse.next();
|
return NextResponse.next();
|
||||||
})
|
})
|
||||||
: () => NextResponse.next();
|
: () => NextResponse.next();
|
||||||
|
|||||||
Reference in New Issue
Block a user