mirror of
https://github.com/iczer/vue-antd-admin
synced 2025-04-06 04:00:06 +08:00
修复:更正 axios 拦截器demo;
This commit is contained in:
parent
c39eba68dc
commit
df7e9f2d1c
@ -9,8 +9,8 @@ const resp401 = {
|
||||
*/
|
||||
onFulfilled(response, options) {
|
||||
const {message} = options
|
||||
if (response.status === 401) {
|
||||
message.error('无此接口权限')
|
||||
if (response.code === 401) {
|
||||
message.error('无此权限')
|
||||
}
|
||||
return response
|
||||
},
|
||||
@ -22,7 +22,10 @@ const resp401 = {
|
||||
*/
|
||||
onRejected(error, options) {
|
||||
const {message} = options
|
||||
message.error(error.message)
|
||||
const {response} = error
|
||||
if (response.status === 401) {
|
||||
message.error('无此权限')
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
}
|
||||
@ -30,10 +33,18 @@ const resp401 = {
|
||||
const resp403 = {
|
||||
onFulfilled(response, options) {
|
||||
const {message} = options
|
||||
if (response.status === 403) {
|
||||
message.error(`请求被拒绝`)
|
||||
if (response.code === 403) {
|
||||
message.error('请求被拒绝')
|
||||
}
|
||||
return response
|
||||
},
|
||||
onRejected(error, options) {
|
||||
const {message} = options
|
||||
const {response} = error
|
||||
if (response.status === 403) {
|
||||
message.error('请求被拒绝')
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user