Home  >  Q&A  >  body text

How to prevent users from accessing my admin route directly from the address bar: workaround in Nuxt and Vue apps

<p>I have some pages (routes) that I only want a specific type of user (admins) to have access to. I can capture the routing event when I click a link in the app, but not when I change the URL from the address bar. How can I catch such URL changes and check the user type before allowing the user to access the page? </p>
P粉178894235P粉178894235391 days ago476

reply all(1)I'll reply

  • P粉803444331

    P粉8034443312023-08-27 15:00:56

    You can use navigation routing. This documentation page is a good starting point
    Navigation Guard Documentation

    reply
    0
  • Cancelreply