Use FreshApiToken instead of Personal access token for front-end auth

This commit is contained in:
Bubka
2021-10-22 14:18:13 +02:00
parent 62d223ef72
commit d6306e5dd0
12 changed files with 65 additions and 60 deletions

View File

@ -56,21 +56,9 @@ router.beforeEach((to, from, next) => {
to.params.isFirstLoad = isFirstLoad ? true : false
isFirstLoad = false;
}
if (to.matched.some(record => record.meta.requiresAuth)) {
// Accesses to restricted pages without a jwt token are routed to the login page
if ( !localStorage.getItem('jwt') ) {
next({
name: 'login'
})
}
// If the jwt token is invalid, a 401 unauthorized is send by the php backend
else {
next()
}
}
else next()
next()
});
router.afterEach(to => {