when im on my protected route and i

when im on my protected route and i signout. the middleware would redirect me to auth page however the url will still say dashboard and things r rendered incorrectly like a bugged rewrite or smth
2 Replies
Sara
Sara3d ago
Show me your middleware.ts? And the sign out function you have
Sιɳɠυʅαɾ Sιɳɠυʅαɾιƚყ
function handleSignOut() {
try {
signOut()
toast.success("You have been signed out successfully")
} catch (_error) {
toast.error("Failed to sign out. Please try again.")
}
}
function handleSignOut() {
try {
signOut()
toast.success("You have been signed out successfully")
} catch (_error) {
toast.error("Failed to sign out. Please try again.")
}
}
export default convexAuthNextjsMiddleware(async (request, { convexAuth }) => {
if (isSignInPage(request) && (await convexAuth.isAuthenticated())) {
return nextjsMiddlewareRedirect(request, "/dashboard");
}
if (isProtectedRoute(request) && !(await convexAuth.isAuthenticated())) {
return nextjsMiddlewareRedirect(request, "/auth");
}
});
export default convexAuthNextjsMiddleware(async (request, { convexAuth }) => {
if (isSignInPage(request) && (await convexAuth.isAuthenticated())) {
return nextjsMiddlewareRedirect(request, "/dashboard");
}
if (isProtectedRoute(request) && !(await convexAuth.isAuthenticated())) {
return nextjsMiddlewareRedirect(request, "/auth");
}
});

Did you find this page helpful?