mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-09 13:55:01 +02:00
Use FreshApiToken instead of Personal access token for front-end auth
This commit is contained in:
16
resources/js/routes.js
vendored
16
resources/js/routes.js
vendored
@ -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 => {
|
||||
|
Reference in New Issue
Block a user