Created
September 16, 2020 09:50
-
-
Save rayfranco/139c676e27300e894311da430b98f567 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router.beforeEach((to, from, next) => { | |
const requiresAuth = to.matched.some(record => { | |
return record.meta.requiresAuth | |
}) | |
if (requiresAuth && !store.$data.isRegistered) { | |
next('/login') | |
} else { | |
next() | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment