
import axios from "axios";
import { ElLoading } from 'element-plus'
import {Local}  from '@/utils/storage/storage.js'
const request = axios.create({
	baseURL:import.meta.env.VITE_APP_API_BASE_URL,
	timeout:5000
});
let loading
request.interceptors.request.use((config)=>{
loading=ElLoading.service({
		lock: true,
		text: '加载中',
		background: 'rgba(0, 0, 0, 0.7)',
	})
	config.headers.Authorization =Local.get('token')
	return config;
});
request.interceptors.response.use((res)=>{
	loading.close()
	return res.data;
},()=>{
	loading.close()
});
export default request;
