Skip to content

Commit

Permalink
fix: Infinite redirection issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dogukanoksuz committed Apr 17, 2024
1 parent 6553526 commit 6d72229
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { IUser } from "./types/user"
const authRoutes = ["/auth/login"]

export function middleware(request: NextRequest) {
const urlBeforeRedirect = request.nextUrl.pathname
let urlBeforeRedirect = request.nextUrl.pathname
if (urlBeforeRedirect === "/auth/login") {
urlBeforeRedirect = "/"
}

if (
request.nextUrl.pathname.includes("_next") ||
Expand Down

0 comments on commit 6d72229

Please sign in to comment.