Static GitHub Issues

[2350] Call Middleware When Full URL is Entered in browser address

prev: How could I add json object in the script label
next: Using and managing GSAP in Nuxt

I have a middleware function that checks for logged in users and redirects them to account page if logged in.

it works well as the user is redirected to the account page after log in using $router.push('/account').

The Problem:

  • When the user is logged in, i typed the full address 'http://www.url.com/accounts' for example and press the "Enter" key, it does not trigger the middleware and it lands on the sign-in page instead.

  • When i refresh the page, it redirects me from account to sign in page as well

Any tips on how do i call the middleware when i enter the full address in the browser?

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2048">#c2048</a>)</em></sub></div>