更新前端config目录文件
This commit is contained in:
parent
18bc7dfa13
commit
06ce725f8d
@ -55,16 +55,20 @@ export const configHandler = config => {
|
||||
if (wsCache.get('user.token')) {
|
||||
config.headers['X-DE-TOKEN'] = wsCache.get('user.token')
|
||||
const expired = isExpired()
|
||||
if (expired && config.url !== refreshUrl) {
|
||||
if (expired && !config.url.includes(refreshUrl)) {
|
||||
if (!getRefreshStatus()) {
|
||||
setRefreshStatus(true)
|
||||
refreshApi()
|
||||
refreshApi(Date.now())
|
||||
.then(res => {
|
||||
userStore.setToken(res.data.token)
|
||||
userStore.setExp(res.data.exp)
|
||||
userStore.setTime(Date.now())
|
||||
config.headers['X-DE-TOKEN'] = res.data.token
|
||||
delayExecute(res.data.token)
|
||||
if (res?.data?.token) {
|
||||
userStore.setToken(res.data.token)
|
||||
userStore.setExp(res.data.exp)
|
||||
userStore.setTime(Date.now())
|
||||
config.headers['X-DE-TOKEN'] = res.data.token
|
||||
delayExecute(res.data.token)
|
||||
} else {
|
||||
delayExecute(null)
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
console.error(e)
|
||||
|
@ -257,6 +257,9 @@ service.interceptors.response.use(
|
||||
if (header.has('DE-FORBIDDEN-FLAG')) {
|
||||
showMsg('当前用户权限配置已变更,请刷新页面', '-changed-')
|
||||
}
|
||||
if (error?.response.status === 400) {
|
||||
return Promise.reject(error)
|
||||
}
|
||||
return Promise.resolve()
|
||||
}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user