修改页面log输出并修改tonken超时判断
This commit is contained in:
@@ -88,6 +88,9 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
||||
config.headers.Authorization = 'Basic bmpjbnRlc3Q6bmpjbnBxcw=='
|
||||
}
|
||||
}
|
||||
if (config.url == '/user-boot/user/generateSm2Key' || config.url == '/pqs-auth/oauth/token') {
|
||||
config.headers.Authorization = 'Basic bmpjbnRlc3Q6bmpjbnBxcw=='
|
||||
}
|
||||
|
||||
return config
|
||||
},
|
||||
@@ -117,10 +120,10 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
||||
window.tokenRefreshing = true
|
||||
return refreshToken()
|
||||
.then(res => {
|
||||
adminInfo.setToken(res.data.token, 'auth')
|
||||
response.headers.Authorization = `${res.data.token}`
|
||||
window.requests.forEach(cb => cb(res.data.token))
|
||||
adminInfo.setToken(res.data.access_token, 'auth')
|
||||
window.requests.forEach(cb => cb(res.data.access_token))
|
||||
window.requests = []
|
||||
|
||||
return Axios(response.config)
|
||||
})
|
||||
.catch(err => {
|
||||
@@ -141,11 +144,11 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
||||
})
|
||||
}
|
||||
} else if (response.data.code == 'A0024') {
|
||||
// // 登录失效
|
||||
// ElNotification({
|
||||
// type: 'error',
|
||||
// message: response.data.message
|
||||
// })
|
||||
// 登录失效
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: response.data.message
|
||||
})
|
||||
adminInfo.removeToken()
|
||||
router.push({ name: 'login' })
|
||||
return Promise.reject(response.data)
|
||||
|
||||
Reference in New Issue
Block a user