Commit 69c19020 authored by 李纪文's avatar 李纪文

feat: 去除错误拦截

parent 17ef21f7
...@@ -37,27 +37,27 @@ instanceRequest.setErrorHandler((error) => { ...@@ -37,27 +37,27 @@ instanceRequest.setErrorHandler((error) => {
const { status, config } = response; const { status, config } = response;
if (status === 401) { if (status === 401) {
if (!instance) { if (!instance) {
instance = warning({ // instance = warning({
title: '错误信息', // title: '错误信息',
content: `${codeMessage[status]}`, // content: `${codeMessage[status]}`,
centered: true, // centered: true,
onOk(close) { // onOk(close) {
window.share && window.share.event && window.share.event.emit('triggerLoginout'); // window.share && window.share.event && window.share.event.emit('triggerLoginout');
close(); // close();
}, // },
}); // });
} }
} else { } else {
notification.error({ // notification.error({
message: `请求错误 ${status}: ${config.url}`, // message: `请求错误 ${status}: ${config.url}`,
description: errorText, // description: errorText,
}); // });
} }
} else if (!response) { } else if (!response) {
notification.error({ // notification.error({
description: '您的网络发生异常,无法连接服务器', // description: '您的网络发生异常,无法连接服务器',
message: '网络异常', // message: '网络异常',
}); // });
} }
return response; return response;
}); });
......
...@@ -34,27 +34,27 @@ instanceRequest.setErrorHandler((error) => { ...@@ -34,27 +34,27 @@ instanceRequest.setErrorHandler((error) => {
const { status, config } = response; const { status, config } = response;
if (status === 401) { if (status === 401) {
if (!instance) { if (!instance) {
instance = warning({ // instance = warning({
title: '错误信息', // title: '错误信息',
content: `${codeMessage[status]}`, // content: `${codeMessage[status]}`,
centered: true, // centered: true,
onOk(close) { // onOk(close) {
window.share && window.share.event && window.share.event.emit('triggerLoginout'); // window.share && window.share.event && window.share.event.emit('triggerLoginout');
close(); // close();
}, // },
}); // });
} }
} else { } else {
notification.error({ // notification.error({
message: `请求错误 ${status}: ${config.url}`, // message: `请求错误 ${status}: ${config.url}`,
description: errorText, // description: errorText,
}); // });
} }
} else if (!response) { } else if (!response) {
notification.error({ // notification.error({
description: '您的网络发生异常,无法连接服务器', // description: '您的网络发生异常,无法连接服务器',
message: '网络异常', // message: '网络异常',
}); // });
} }
return response; return response;
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment