// 创建实例时配置默认值
import axios from "axios";
import router from "../router";

// const viteEnv = import.meta.env;

const myAxios = axios.create({
    withCredentials: true,
   // baseURL:'http://localhost:9091'
    baseURL:'http://localhost:9092'
   // baseURL:'http://1.94.237.210:3457'
    //baseURL:'http://1.94.237.210:8088'
    //baseURL:'http://27.30.77.229:9091/'
    //baseURL:'http://27.30.77.229:9092/'

});

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;