|
@@ -26,14 +26,14 @@ let toast: ReturnType<typeof setTimeout>;
|
|
|
|
|
|
request.interceptors.request.use(
|
|
|
(url, options: any) => {
|
|
|
- if (!options.hideLoading) {
|
|
|
- clearTimeout(toast);
|
|
|
- showLoadingToast({
|
|
|
- message: '加载中...',
|
|
|
- forbidClick: true,
|
|
|
- duration: 0
|
|
|
- });
|
|
|
- }
|
|
|
+ // if (!options.hideLoading) {
|
|
|
+ // clearTimeout(toast);
|
|
|
+ // showLoadingToast({
|
|
|
+ // message: '加载中...',
|
|
|
+ // forbidClick: true,
|
|
|
+ // duration: 0
|
|
|
+ // });
|
|
|
+ // }
|
|
|
|
|
|
initRequest = options.initRequest || false;
|
|
|
const Authorization = storage.get(ACCESS_TOKEN) || '';
|
|
@@ -68,11 +68,11 @@ request.interceptors.request.use(
|
|
|
|
|
|
request.interceptors.response.use(
|
|
|
async res => {
|
|
|
- toast = setTimeout(() => {
|
|
|
- closeToast();
|
|
|
- }, 100);
|
|
|
+ // toast = setTimeout(() => {
|
|
|
+ // closeToast();
|
|
|
+ // }, 100);
|
|
|
if (res.status > 299 || res.status < 200) {
|
|
|
- clearTimeout(toast);
|
|
|
+ // clearTimeout(toast);
|
|
|
const msg = '服务器错误,状态码' + res.status;
|
|
|
showToast(msg);
|
|
|
throw new Error(msg);
|
|
@@ -82,7 +82,7 @@ request.interceptors.response.use(
|
|
|
if (data.code !== 200 && data.errCode !== 0 && data.code !== 999) {
|
|
|
let msg = data.msg || data.message || '处理失败,请重试';
|
|
|
if (!(data.code === 403 || data.code === 5000)) {
|
|
|
- clearTimeout(toast);
|
|
|
+ // clearTimeout(toast);
|
|
|
showToast(msg);
|
|
|
}
|
|
|
if (data.code === 5000 || data.code === 403) {
|