Axios在请求拦截器中返回数据

有什么方法可以在axios请求拦截器中发送数据和取消请求?像这样:

axios.request.use(config => {
  // dont want to call the request,return data like they come from response
  if (someCondition) {
      return Promise.resolve(['someData']);
  }
  // execute request
  else {
      return config;
  }
});

用例:应用程序连续4次调用相同的API请求(我知道这很不好),我想只处理第一个,并向所有请求返回相同的数据。

xiangan2010 回答:Axios在请求拦截器中返回数据

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3098739.html

大家都在问