Commit aeeda94f by 姜雷

当取消请求时不提示错误

parent 5b061966
import { isCancel } from 'axios';
import { Message, MessageBox } from 'element-ui'; import { Message, MessageBox } from 'element-ui';
import store from '../store'; import store from '../store';
...@@ -37,10 +38,14 @@ export const errorHandle = error => { ...@@ -37,10 +38,14 @@ export const errorHandle = error => {
}); });
return Promise.reject({ error, msg: '请求超时!' }); return Promise.reject({ error, msg: '请求超时!' });
} }
Message({ if (isCancel(error)) {
message: error.message, console.log('取消请求');
type: 'error', } else {
duration: 5 * 1000, Message({
}); message: error.message,
type: 'error',
duration: 5 * 1000,
});
}
return Promise.reject(error); return Promise.reject(error);
}; };
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