import axios from 'axios'

let host = ''
if (window.location.port === '3000') {
  host = '//localhost:1024/'
}else if (window.location.host.match('test')) {
  host = '//test-api-hr.duowan.com'
} else{
  host = '//api-hr.duowan.com'
}

let ax = axios.create({
  baseURL: host,
  headers: { 'Content-Type': 'multipart/form-data' },
  transformRequest: [],
  transformResponse: [],
  withCredentials: true
})

ax.host = host

ax.interceptors.request.use(
  
)

// 拦截器处理错误
ax.interceptors.response.use(
  response => {
    return Promise.resolve(response.data)
  },
  error => {
    return Promise.reject(error)
  }
)

export default ax
