Route is not changing after redirection to "/profile"
Unanswered
Rahul Srivastava posted this in #help-forum
Hi devs! I am having issue regarding the redirection from middleware. The route is not changing(http://localhost:3000) but page loads and when I refresh the page the route also changed to http://localhost:3000/profile. I am checking new_user from cookies and if newUser is true then I redirect to profile page.
Below is my middleware.
Below is my middleware.
2 Replies
Please help. Having issue in these lines
if (newUser?.value === "true") {
if (pathname !== "/profile") return NextResponse.redirect(new URL("/profile", request.url));
}
if (newUser?.value === "true") {
if (pathname !== "/profile") return NextResponse.redirect(new URL("/profile", request.url));
}