mirror of
https://github.com/iczer/vue-antd-admin
synced 2025-06-14 22:11:30 +08:00
调整校验登录失效顺序,防止手工清理cookie时页面假死;同时在登录失效时调用logout清理缓存
This commit is contained in:
parent
75c4619bdc
commit
649862a4f8
@ -1,6 +1,7 @@
|
||||
import {hasAuthority} from '@/utils/authority-utils'
|
||||
import {loginIgnore} from '@/router/index'
|
||||
import {checkAuthorization} from '@/utils/request'
|
||||
import {logout} from '@/services/user'
|
||||
import NProgress from 'nprogress'
|
||||
|
||||
NProgress.configure({ showSpinner: false })
|
||||
@ -28,7 +29,8 @@ const progressStart = (to, from, next) => {
|
||||
*/
|
||||
const loginGuard = (to, from, next, options) => {
|
||||
const {message} = options
|
||||
if (!loginIgnore.includes(to) && !checkAuthorization()) {
|
||||
if (!checkAuthorization() && !loginIgnore.includes(to)) {
|
||||
logout()
|
||||
message.warning('登录已失效,请重新登录')
|
||||
next({path: '/login'})
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user