You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
448 B
23 lines
448 B
import NProgress from "nprogress"
|
|
import "nprogress/nprogress.css"
|
|
import router from "@/router"
|
|
import store from '@/store'
|
|
|
|
const whitePath = [ '/login']
|
|
// 判断登录
|
|
router.beforeEach((to, from, next) => {
|
|
NProgress.start()
|
|
const token = store.getters.getToken;
|
|
if(!token && !whitePath.includes(to.path)) {
|
|
next('/login');
|
|
} else {
|
|
next();
|
|
NProgress.done()
|
|
}
|
|
})
|
|
|
|
router.afterEach(() => {
|
|
NProgress.done()
|
|
})
|
|
|
|
export default router |