perf[permission]: add the verification of roles

This commit is contained in:
Pan
2018-05-02 17:38:00 +08:00
committed by 花裤衩
parent c3ee00472d
commit 0fea37b675
2 changed files with 9 additions and 5 deletions

View File

@@ -16,10 +16,10 @@ router.beforeEach((to, from, next) => {
if (store.getters.roles.length === 0) {
store.dispatch('GetInfo').then(res => { // 拉取用户信息
next()
}).catch(() => {
}).catch((err) => {
store.dispatch('FedLogOut').then(() => {
Message.error('验证失败,请重新登录')
next({ path: '/login' })
Message.error(err || 'Verification failed, please login again')
next({ path: '/' })
})
})
} else {