How to prevent users from accessing my admin route directly from the address bar: workaround in Nuxt and Vue apps
P粉178894235
2023-08-26 16:23:05
<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>
You can use
navigation routing
. This documentation page is a good starting pointNavigation Guard Documentation