import axios from 'axios'

// axios.defaults.baseURL = '/api'

const service = axios.create({
    baseURL: '/api',
    timeout: 4000,
    headers: {
        'X-Requested-With': 'XMLHttpRequest',
        'Content-Type': 'application/json; charset=UTF-8'
    }
})
service.interceptors.request.use(
    (config) => {
        return config
    },
    (error) => {
        Promise.reject(error)
    }
)

// response interceptor
service.interceptors.response.use(
    (response) => {
        const res = response.data
        return res
    },
    () => {}
)
export default service
