提交 999fe39e authored 作者: 徐立's avatar 徐立

调整请求

上级 2fbec233
...@@ -33,12 +33,12 @@ var canReportError = true; ...@@ -33,12 +33,12 @@ var canReportError = true;
const errorHandler = error => { const errorHandler = error => {
const { response } = error; const { response } = error;
console.log(process.env.NODE_ENV)
if (response && response.status) { if (response && response.status) {
const errorText = codeMessage[response.status] || response.statusText; const errorText = codeMessage[response.status] || response.statusText;
notification.error({ notification.error({
message: `请求错误`, message: `请求错误`,
description: errorText, description: process.env.NODE_ENV==='development'? errorText:'',
}); });
if (response.status === 401) { if (response.status === 401) {
...@@ -98,14 +98,14 @@ export const request = (url, data, options = {}) => { ...@@ -98,14 +98,14 @@ export const request = (url, data, options = {}) => {
if (response.errCode || response.errMsg) { if (response.errCode || response.errMsg) {
notification.error({ notification.error({
message: `请求错误`, message: `请求错误`,
description: response.errMsg, description: process.env.NODE_ENV==='development'? response.errMsg:'',
}); });
return; return;
} }
if (response.errcode) { if (response.errcode) {
notification.error({ notification.error({
message: `请求错误`, message: `请求错误`,
description: response.errmsg, description: process.env.NODE_ENV==='development'? response.errmsg:'',
}); });
return; return;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论