This commit is contained in:
kclf
2022-12-04 20:06:18 +08:00
parent a19b87299f
commit 2c4e6c08ff
3 changed files with 541 additions and 521 deletions

View File

@@ -24,18 +24,19 @@ const http = axios.create({
http.interceptors.request.use(
(config) => {
// console.log('config', config)
console.log("config", config);
// const token = localStorage.getItem("token");
// // const token = getCookie('token')
// // console.log('token', token)
// if (token) {
// config.headers.token = token; //测试1111
// } else {
// console.log("当前请求页面无token,请执行操作!!!");
// console.log("当前请求页面无token,请执行操作!!!");
// // 此处测试默认配置token
// config.headers.token = "123456";
// }
// // 此处测试默认配置token
// config.headers.token =
// "eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2NzAxNTMxMDMsImV4cCI6MTY3MDE2MDMwMywiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjZCMDQ5RkFGLUMzMTQtN0NDRi0wRDI4LTBEMjNGNEM0MjUzMSIsInVJZCI6Ijk2NTM0MjAyNzQ5NzYwNzE2OCIsInBlcm1pc3Npb24iOiIifQ==.c937b2d3a59cbab2136fdde55fd38f06bdff041212aab0fa6741bc4be41e28a7";
// // }
return config;
},
(err) => {
@@ -64,8 +65,8 @@ http.interceptors.response.use(
},
function (error) {
if (error.message == "timeout of 1ms exceeded") {
message.destroy()
message.error("请求超时")
message.destroy();
message.error("请求超时");
}
console.log("api error %o", error);
return Promise.reject(error);