import Vue from 'vue';
import axios from 'axios';
//登录状态
let loginStatus = true;
const service = axios.create({
	baseURL: '',
	timeout: 5000,
});

service.interceptors.request.use(config => {
	//全局添加头
	config.headers.accessToken = new Vue().$store.state.accessToken;
	return config;
}, error => {
	return Promise.reject(error);
});
service.interceptors.response.use(res => {
	return res;
}, (error) => {
	return {
		data:{
			"retHead": {
				"errCode": 1,
			},
			"retBody": {}
		}
	}
	// return Promise.reject(error);
})
export default service
