import axios from 'axios'
import nprogress from 'nprogress'
import 'nprogress/nprogress.css'
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
const requests = axios.create({
    // axios中请求配置有baseURL选项，表示请求URL公共部分
    baseURL: 'http://127.0.0.1:8188/api',
    // 超时
    timeout: 5000
})
//请求拦截器
requests.interceptors.request.use((config)=>{
    nprogress.start();
    return config
})
//响应拦截器
requests.interceptors.response.use((res)=>{
    nprogress.done();
    return res.data
},(error)=>{

})
export default requests
