2025-06-18 09:26:56 +08:00
|
|
|
// 创建实例时配置默认值
|
|
|
|
import axios from "axios";
|
|
|
|
import router from "../router";
|
|
|
|
|
|
|
|
// const viteEnv = import.meta.env;
|
|
|
|
|
|
|
|
const myAxios = axios.create({
|
|
|
|
withCredentials: true,
|
2025-07-02 09:43:17 +08:00
|
|
|
// baseURL:'http://localhost:9091'
|
2025-07-06 22:25:17 +08:00
|
|
|
//baseURL:'http://localhost:9092'
|
2025-06-18 09:26:56 +08:00
|
|
|
// baseURL:'http://1.94.237.210:3457'
|
|
|
|
//baseURL:'http://1.94.237.210:8088'
|
2025-06-23 10:12:52 +08:00
|
|
|
//baseURL:'http://27.30.77.229:9091/'
|
2025-06-24 20:27:14 +08:00
|
|
|
//baseURL:'http://27.30.77.229:9092/'
|
2025-07-06 22:25:17 +08:00
|
|
|
// baseURL:'http://160.202.242.36:9092/'
|
|
|
|
baseURL:'http://160.202.242.36:9092/'
|
|
|
|
|
2025-06-18 09:26:56 +08:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
myAxios.interceptors.request.use(function (config) {
|
|
|
|
return config;
|
|
|
|
}, function (error) {
|
|
|
|
return Promise.reject(error);
|
|
|
|
});
|
|
|
|
|
|
|
|
myAxios.interceptors.response.use(function (response: any) {
|
|
|
|
if (response.data.code === 40100) {
|
|
|
|
router.replace('/')
|
|
|
|
}
|
|
|
|
return response.data;
|
|
|
|
}, function (error) {
|
|
|
|
return Promise.reject(error);
|
|
|
|
});
|
|
|
|
|
|
|
|
export default myAxios;
|