updates to profile and login code

This commit is contained in:
Tobias Kurze
2019-04-08 10:43:17 +02:00
parent 9a91f40c65
commit a15e0c2d50
4 changed files with 39 additions and 17 deletions

View File

@@ -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: '*',