import axios from 'axios'

export const api = axios.create({
  // baseURL: 'https://ccb.canary.moe/api/',
  // baseURL: window.location.origin + '/api/',
  // baseURL: 'https://canary.lacus.site/api/',
  baseURL: 'https://canary.lacus.icu/api/',
  // baseURL: 'http://beta.lacus.site/api/',
  // baseURL: 'http://152.136.99.231:8001' + '/api/',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded',
    'Accept': 'application/json',
    'Access-Control-Allow-Origin': '*'
  },
  timeout: 10 * 1000
})

//设置拦截器
api.interceptors.response.use(
  (response) => {
    // console.log('拦截器:请求成功', response)
    return response
  }, (error) => {
    // console.log('拦截器:发生错误', error.response)
    return Promise.reject(error)
  }
)
