[Vuejs]-How to avoid "Error: Avoided redundant navigation to current location: "/inside/home" when auth guard won't allow that route

0👍

So the key issue here is that guards are not applied to redirects. i.e. you can’t stop a route redirecting via a guard. So even if the guard would fail, the redirect goes through.

So only after all redirects have been applied would the guard be applied.

In my case, I’m on a specific page (a route) and the user clicks on logout. What I was hoping to be able to do is just to enact the logout and then sent the user back to the "default" or first page. This doesn’t work as that page just happens to be the same place as I am currently on and because the guards are not applied (they would fail as the user is logged out) vue deems the route to be sending me back to the same place. Ordinarily, if the guards were applied I’d be routed to the login page.

The solution is to not send the user to the landing page but rather send them to the login page or other default "outside" garden page.

Leave a comment