import axios from "axios"
import { useGlobalState } from '../store/index'

const state = useGlobalState()

const service = axios.create({
	baseURL: 'http://10.83.68.108:8091/ghjgWebServiceTest',
	timeout: 60000, // 请求超时时间 毫秒
	// withCredentials: true,
	headers: {
		"Content-Type": "application/json",
	},
})

service.interceptors.request.use(
	(config) => {
		// config.data.token = state.token.value
		return config;
	},
	(error) => {
		return Promise.reject(error);
	}
)

service.interceptors.response.use(
	(response) => {
		const res = response.data;
		return res;
	},
	(error) => {
		return Promise.reject(error);
	}
)

export default service;

