We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do you add route guards to this app? I tried adding the following in the index.js:
router.beforeEach((to, from, next) => { const token = localStorage.usertoken const requiresAuth = to.matched.some(record => record.meta.requiresAuth) if (requiresAuth && !token) next('login') else if (!requiresAuth && token) next('profile') else next() }) export default router
... in order to prevent the user from being logged out after refreshing the page, but to no avail. Any recommendations on how to add route guards?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
How do you add route guards to this app? I tried adding the following in the index.js:
... in order to prevent the user from being logged out after refreshing the page, but to no avail. Any recommendations on how to add route guards?
The text was updated successfully, but these errors were encountered: