|
@@ -9,7 +9,8 @@ Router.prototype.push = function push(location) {
|
|
|
|
|
|
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
router.beforeEach((to, from, next) => {
|
|
- // console.log(to);
|
|
|
|
|
|
+ console.log(from);
|
|
|
|
+ console.log(to);
|
|
if (to.fullPath === '/' || to.name === '*') {
|
|
if (to.fullPath === '/' || to.name === '*') {
|
|
let {
|
|
let {
|
|
code,
|
|
code,
|
|
@@ -32,6 +33,15 @@ router.beforeEach((to, from, next) => {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- next();
|
|
|
|
|
|
+ if (from.path === '/login' || from.name === 'login') {
|
|
|
|
+ if (localStorage.getItem('Authorization')) {
|
|
|
|
+ next();
|
|
|
|
+ } else {
|
|
|
|
+ // next(false);
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ next();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
});
|
|
});
|