|
@@ -502,7 +502,7 @@ const router = new VueRouter({
|
|
|
});
|
|
|
|
|
|
router.beforeEach(async (to, form, next) => {
|
|
|
- if (to.name == 'account_user' || to.name == 'viewTwo_account') {
|
|
|
+ if (to.name == 'account_user') {
|
|
|
let res = await store.dispatch('login/toGetUser');
|
|
|
if (res && res.uid) {
|
|
|
next();
|
|
@@ -514,6 +514,19 @@ router.beforeEach(async (to, form, next) => {
|
|
|
next();
|
|
|
} else {
|
|
|
next({ name: 'login' });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (to.name == 'viewTwo_account') {
|
|
|
+ let res = await store.dispatch('login/toGetUser');
|
|
|
+ if (res && res.uid) {
|
|
|
+ next();
|
|
|
+ } else {
|
|
|
+ let key = sessionStorage.getItem('token');
|
|
|
+ let user = jwt.decode(key);
|
|
|
+ if (user && user.uid) {
|
|
|
+ store.commit('setUser', user, { root: true });
|
|
|
+ next();
|
|
|
+ } else {
|
|
|
next({ name: 'twoLogin' });
|
|
|
}
|
|
|
}
|