夜间模式CodeSnippetStyle:
日间模式CodeSnippetStyle:

0%


#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'))
  };
});
posted @ 2021-05-03 11:28  暮冬有八  阅读(797)  评论(0编辑  收藏  举报
BACK TO TOP

😀迷海无灯听船行。Github WeChat