Skip to content

Commit

Permalink
Solved 404 page when signout from the app.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArhanAnsari committed Aug 21, 2024
1 parent d29424d commit a56a8b7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions middleware.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";

// myapp.com/dashboard/*
const isProtectedRoute = createRouteMatcher(["/dashboard(.*)"]);
//const isProtectedRoute = createRouteMatcher(["/dashboard(.*)"]);

export default clerkMiddleware((auth, req) => {
/*export default clerkMiddleware((auth, req) => {
if (isProtectedRoute(req)) {
auth().protect();
}
});*/

const isPublicRoute = createRouteMatcher(["/", "/sign-in", "/sign-up"]);
// const isProtectedRoute = createRouteMatcher(["/dashboard(.*)"]);
export default clerkMiddleware((auth, req) => {
if (!auth().userId && !isPublicRoute(req)) {
return auth().redirectToSignIn();
}
});

export const config = {
Expand Down

0 comments on commit a56a8b7

Please sign in to comment.