request_20220409153243.js 992 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // // 添加请求拦截器
  2. // axios.interceptors.request.use(
  3. // function (config) {
  4. // return mgr.getUser().then((res) => {
  5. // if (!res || !res.access_token || res.expired) {
  6. // login();
  7. // return;
  8. // }
  9. // // if (res.expired) {
  10. // // login();
  11. // // return;
  12. // // }
  13. // const token = res.access_token;
  14. // config.headers["Authorization"] = `Bearer ${token}`;
  15. // return config;
  16. // });
  17. // },
  18. // function (error) {
  19. // // 对请求错误做些什么
  20. // return Promise.reject(error);
  21. // }
  22. // );
  23. // axios.interceptors.response.use(
  24. // function (response) {
  25. // if (response && response.data) {
  26. // return response.data;
  27. // }
  28. // return response;
  29. // },
  30. // function (error) {
  31. // console.log("AXIOS ERR");
  32. // console.log(error);
  33. // if (error.toString().indexOf("401") >= 0) {
  34. // login();
  35. // return;
  36. // }
  37. // return Promise.reject(error);
  38. // }
  39. // );