How to stop middleware error page endless refresh?
Unanswered
Blanc de Hotot posted this in #help-forum
Blanc de HototOP
Hi
I have a middleware that validates the user's auth, checks if he has access role for that route, and either allows him to access the page or redirects him to the login.
My problem is that when the user is allowed to access a route ("./admin/.") but gets some error, like 404 page not found or something else, then his page refreshes endlessly.
A showcase of the middleware file and the video showcasing the endless refresh are attached.
Does anyone know what I can do to stop the page from refreshing endlessly. I have identified that the problem is with returning res, a TODO is set in the code.
Best regards Aron
I have a middleware that validates the user's auth, checks if he has access role for that route, and either allows him to access the page or redirects him to the login.
My problem is that when the user is allowed to access a route ("./admin/.") but gets some error, like 404 page not found or something else, then his page refreshes endlessly.
A showcase of the middleware file and the video showcasing the endless refresh are attached.
Does anyone know what I can do to stop the page from refreshing endlessly. I have identified that the problem is with returning res, a TODO is set in the code.
Best regards Aron