PanJiaChen / vue-admin-template

a vue2.0 minimal admin template
https://git.io/fAnuM
MIT License
19.96k stars 7.42k forks source link

getToken() always return undefined even when login success #463

Open zinwalin opened 5 years ago

zinwalin commented 5 years ago

src\permission.js

router.beforeEach(async(to, from, next) => {
  // start progress bar
  NProgress.start()

  // set page title
  document.title = getPageTitle(to.meta.title)

  // determine whether the user has logged in
  const hasToken = getToken()

  if (hasToken) {
zinwalin commented 5 years ago

beforeEach come with async func, and getToken() return undefined there. Does async calling cause this issue?