Disable cache for Axios
1. set headers.Cache-Control = 'no cache' // not work for 0.19.x or later?
2. set timestamp in url parameter for each request(need backend work)

export const client = axios.create({
    baseURL: 'https://www.abc.com/api',
    timeout: 10000,
});

client.interceptors.request.use(
    config => {
        config.params = {...config.params, timestamp: Date.now()};
        config.headers.Authorize = localStorage.getItem('token') || '';
        return config
    },
    error => Promise.reject(error)
);

 

相关文章:

  • 2021-12-16
  • 2021-12-03
  • 2021-11-25
  • 2021-10-07
  • 2021-12-27
  • 2022-01-29
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-25
  • 2019-09-20
  • 2021-09-19
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案