Vue Router 4 guard redirects in an infinite loop
Vue 3.4 plus Vue Router 4.3. I have a beforeEach guard that sends unauthenticated users to /login. But it also runs on /login, so it redirects to /login forever and the browser shows ERR_TOO_MANY_REDIRECTS after about 21 hops. I added a check for to.path === '/login' but it still loops sometimes. What am I missing? The error page just says too many redirects, which tells me nothing.
4 replies