updates to profile and login code
This commit is contained in:
@@ -52,6 +52,20 @@ export const router = new Router({
|
||||
path: '/profile',
|
||||
name: 'Profile',
|
||||
component: Profile,
|
||||
beforeEnter(to, from, next) {
|
||||
if (!store.getters.isAuthenticated) {
|
||||
Vue.$log.debug('not authenticated!');
|
||||
if (store.getters.isRefreshTokenValid) {
|
||||
store.dispatch('refreshToken')
|
||||
.then(() => next())
|
||||
.catch(() => next('/login'));
|
||||
} else {
|
||||
next('/login');
|
||||
}
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
|
||||
Reference in New Issue
Block a user