import axios from 'axios';

const axiosInstance = axios.create({
  // 腾讯云测试环境
  baseURL: 'http://aihub-dag-test.digitalyili.com',
  // 本地开发
  // baseURL: 'http://192.168.199.110:18082',
  // 电信云测试环境
  // baseURL: 'http://aihub-dag-idctest.digitalyili.com',
  // sxkj
  // baseURL: 'http://aihub-dag.sxkj.com',
  timeout: 1200000,
  headers: {
    'Content-Type': 'application/json;charset=UTF-8',
    Accept: 'application/json'
  }
});

// 请求拦截器
axiosInstance.interceptors.request.use((config: any) => {
  config.headers['user-token'] = localStorage.getItem('user_token');
  config.headers['item-token'] = localStorage.getItem('project_token');
  config.headers.Authorization = localStorage.getItem('AI.jpt_token');
  return config;
});

export default axiosInstance;
