12345678910111213141516171819202122232425262728293031323334353637383940 |
- // // 添加请求拦截器
- // axios.interceptors.request.use(
- // function (config) {
- // return mgr.getUser().then((res) => {
- // if (!res || !res.access_token || res.expired) {
- // login();
- // return;
- // }
- // // if (res.expired) {
- // // login();
- // // return;
- // // }
- // const token = res.access_token;
- // config.headers["Authorization"] = `Bearer ${token}`;
- // return config;
- // });
- // },
- // function (error) {
- // // 对请求错误做些什么
- // return Promise.reject(error);
- // }
- // );
- // axios.interceptors.response.use(
- // function (response) {
- // if (response && response.data) {
- // return response.data;
- // }
- // return response;
- // },
- // function (error) {
- // console.log("AXIOS ERR");
- // console.log(error);
- // if (error.toString().indexOf("401") >= 0) {
- // login();
- // return;
- // }
- // return Promise.reject(error);
- // }
- // );
|