import axios from "axios" import { useGlobalState } from '../store/index' const state = useGlobalState() const service = axios.create({ baseURL: 'https://10.83.240.193:8090/digitalTwain', 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; if (res!==null && res!=undefined) { return res; }else { console.log("请求出现错误") } }, (error) => { return Promise.reject(error); } ) export default service;