#axios 拦截器 取消请求,#axios interceptors.request cancel a http request #使用axios在request拦截器中取消请求
instance.interceptors.request.use(config => {
/* some logic */
const CancelToken = Axios.CancelToken;
return {
...config,
cancelToken: new CancelToken((cancel) => cancel('Cancel repeated request'))
};
});