import router from '@/router'
import 'nprogress/nprogress.css'

const whiteList = ['/login']
router.beforeEach(async (to, from, next) => {
  next()
  /* const hasToken = getToken()
  // 登录验证
  if (hasToken) {
    const hasGetUserInfo = store.getters.roleId
    if (hasGetUserInfo) {
      next()
    } else {
      try {
        await store.dispatch('fetchUserInfo')
        next()
      } catch (error) {
        await store.dispatch('reset')
        next('/login')
        /!* ?redirect=${to.path}*!/
      }
    }
  } else {
    if (whiteList.indexOf(to.path) !== -1) {
      next()
    } else {
      next('/login')
      /!* ?redirect=${to.path}*!/
    }
  }*/
})
