Commit d9d2cb7b by Jay

.

parent 1f1c9e78
...@@ -14,7 +14,7 @@ Vue.config.productionTip = false; ...@@ -14,7 +14,7 @@ Vue.config.productionTip = false;
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
// document.title = to.meta.title; // document.title = to.meta.title;
const isLogin = localStorage.getItem('authJWT') ? true : false; const isLogin = localStorage.getItem('authJWT') ? true : false;
if (isLogin) { if (isLogin && JSON.parse(atob(localStorage.getItem('authJWT').split('.')[1])).level !== undefined) {
if (to.path === '/login') { if (to.path === '/login') {
next('/home'); next('/home');
} else if (to.path === '/') { } else if (to.path === '/') {
...@@ -39,13 +39,7 @@ router.beforeEach((to, from, next) => { ...@@ -39,13 +39,7 @@ router.beforeEach((to, from, next) => {
next(); next();
} else { } else {
localStorage.setItem('lastUrl', to.fullPath); localStorage.setItem('lastUrl', to.fullPath);
// this.$router.push({ name: 'login', query: { redirect: '/path' } }); next('/login');
next({
path: '/login',
query: {
nextUrl: to.fullPath
}
});
} }
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment