|
|
@ -9,8 +9,8 @@ const resp401 = { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
onFulfilled(response, options) { |
|
|
|
onFulfilled(response, options) { |
|
|
|
const {message} = options |
|
|
|
const {message} = options |
|
|
|
if (response.status === 401) { |
|
|
|
if (response.code === 401) { |
|
|
|
message.error('无此接口权限') |
|
|
|
message.error('无此权限') |
|
|
|
} |
|
|
|
} |
|
|
|
return response |
|
|
|
return response |
|
|
|
}, |
|
|
|
}, |
|
|
@ -22,7 +22,10 @@ const resp401 = { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
onRejected(error, options) { |
|
|
|
onRejected(error, options) { |
|
|
|
const {message} = options |
|
|
|
const {message} = options |
|
|
|
message.error(error.message) |
|
|
|
const {response} = error |
|
|
|
|
|
|
|
if (response.status === 401) { |
|
|
|
|
|
|
|
message.error('无此权限') |
|
|
|
|
|
|
|
} |
|
|
|
return Promise.reject(error) |
|
|
|
return Promise.reject(error) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -30,10 +33,18 @@ const resp401 = { |
|
|
|
const resp403 = { |
|
|
|
const resp403 = { |
|
|
|
onFulfilled(response, options) { |
|
|
|
onFulfilled(response, options) { |
|
|
|
const {message} = options |
|
|
|
const {message} = options |
|
|
|
if (response.status === 403) { |
|
|
|
if (response.code === 403) { |
|
|
|
message.error(`请求被拒绝`) |
|
|
|
message.error('请求被拒绝') |
|
|
|
} |
|
|
|
} |
|
|
|
return response |
|
|
|
return response |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
onRejected(error, options) { |
|
|
|
|
|
|
|
const {message} = options |
|
|
|
|
|
|
|
const {response} = error |
|
|
|
|
|
|
|
if (response.status === 403) { |
|
|
|
|
|
|
|
message.error('请求被拒绝') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return Promise.reject(error) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|