parent
33787eadf1
commit
c8b0df3774
43 changed files with 58 additions and 65 deletions
@ -1,13 +1,14 @@ |
|||||||
import router from "./index"; |
import router from "./index"; |
||||||
import Setting from "@/setting"; |
import Setting from "@/setting"; |
||||||
import util from "@/libs/util"; |
import util from "@/libs/util"; |
||||||
|
import store from '@/store' |
||||||
|
|
||||||
const whiteList = Setting.whiteList // 白名单
|
const whiteList = Setting.whiteList // 白名单
|
||||||
router.beforeEach((to, from, next) => { |
router.beforeEach((to, from, next) => { |
||||||
document.title = Setting.titleSuffix; |
document.title = Setting.titleSuffix |
||||||
const role = util.local.get(Setting.tokenKey); |
const role = util.session.get(Setting.tokenKey) |
||||||
if (!role && !whiteList.includes(to.path)) { |
if (!role && !whiteList.includes(to.path)) { |
||||||
next('/login') |
store.dispatch('user/logout') |
||||||
} else { |
} else { |
||||||
next() |
next() |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue