mirror of
https://github.com/zuiidea/antd-admin
synced 2026-11-03 08:24:07 +00:00
fixed:the error request should be capured in catch method
This commit is contained in:
@@ -89,12 +89,12 @@ export default function request (options) {
|
||||
return fetch(options).then((response) => {
|
||||
const { statusText, status } = response
|
||||
let data = options.fetchType === 'YQL' ? response.data.query.results.json : response.data
|
||||
return {
|
||||
return Promise.resolve({
|
||||
success: true,
|
||||
message: statusText,
|
||||
statusCode: status,
|
||||
...data,
|
||||
}
|
||||
})
|
||||
}).catch((error) => {
|
||||
const { response } = error
|
||||
let msg
|
||||
@@ -107,6 +107,6 @@ export default function request (options) {
|
||||
statusCode = 600
|
||||
msg = error.message || 'Network Error'
|
||||
}
|
||||
return { success: false, statusCode, message: msg }
|
||||
return Promise.reject({ success: false, statusCode, message: msg })
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user