|
@@ -17,7 +17,7 @@ NProgress.configure({
|
|
|
showSpinner: false
|
|
|
}) // NProgress Configuration
|
|
|
|
|
|
-const whiteList = ['/login', '/dashboard'] // no redirect whitelist
|
|
|
+const whiteList = ['/login'] // no redirect whitelist
|
|
|
|
|
|
router.beforeEach(async (to, from, next) => {
|
|
|
// start progress bar
|
|
@@ -41,10 +41,9 @@ router.beforeEach(async (to, from, next) => {
|
|
|
const hasGetUserInfo = store.getters.name
|
|
|
// console.log(store.getters)
|
|
|
if (store.getters.token) {
|
|
|
-
|
|
|
- // if (!whiteList.includes(to.path)) {
|
|
|
- // checkLoginUser();
|
|
|
- // }
|
|
|
+ if (!whiteList.includes(to.path)) {
|
|
|
+ checkLoginUser();
|
|
|
+ }
|
|
|
next();
|
|
|
} else {
|
|
|
// try {
|
|
@@ -82,11 +81,17 @@ router.beforeEach(async (to, from, next) => {
|
|
|
// next(`/login?redirect=${to.path}`)
|
|
|
// NProgress.done()
|
|
|
// }
|
|
|
+
|
|
|
if (whiteList.indexOf(to.path) !== -1) {
|
|
|
- if (!whiteList.includes(to.path)) {
|
|
|
- checkLoginUser();
|
|
|
- }
|
|
|
- next();
|
|
|
+ // if(!localStorage.getItem('ws-pf_userId')){
|
|
|
+ // next(getLoginOutUrl() + `?redirect=${to.path}`);
|
|
|
+ // NProgress.done();
|
|
|
+ // }else{
|
|
|
+ if (!whiteList.includes(to.path)) {
|
|
|
+ checkLoginUser();
|
|
|
+ }
|
|
|
+ next();
|
|
|
+ // }
|
|
|
} else {
|
|
|
next(getLoginOutUrl() + `?redirect=${to.path}`);
|
|
|
NProgress.done();
|