clerk was missing /shared npm package

This commit is contained in:
zach
2026-03-05 22:59:16 -05:00
parent 2fa0be9d23
commit 7fd8a21d1c
8 changed files with 34 additions and 71 deletions

View File

@@ -7,8 +7,11 @@ const isProtectedRoute = createRouteMatcher([
]);
export const onRequest = clerkMiddleware((auth, context) => {
if (!auth().userId && isProtectedRoute(context.request)) {
// Redirect unauthenticated users to the sign-in page
return auth().redirectToSignIn();
const { isAuthenticated, redirectToSignIn } = auth()
if (!isAuthenticated && isProtectedRoute(context.request)) {
// Add custom logic to run before redirecting
return redirectToSignIn()
}
});