clerk was missing /shared npm package
This commit is contained in:
@@ -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()
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user