ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

#axios 拦截器 取消请求,#axios interceptors.request cancel a http request #使用axios在request拦截器中取消请求

2021-05-03 11:32:14  阅读:22  来源: 互联网

标签:拦截器 request axios cancel config CancelToken


instance.interceptors.request.use(config => {
  /* some logic */
  const CancelToken = Axios.CancelToken;
  return {
    ...config,
    cancelToken: new CancelToken((cancel) => cancel('Cancel repeated request'))
  };
});

标签:拦截器,request,axios,cancel,config,CancelToken
来源: https://www.cnblogs.com/jaycethanks/p/14727179.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有