You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
492 B

// 引入第三方请求库axios
import axios from 'axios'
// 创建axios实例
const server = axios.create({
baseURL:import.meta.env.VITE_APP_BASE_API,
timeout:10000,
})
// 创建请求拦截器
server.interceptors.request.use((config) => {
return config
})
// 创建相应拦截器
server.interceptors.response.use((response:any) => {
if(response.status === 200){
return response.data
}
// return response
})
// 暴露axios实例
export default server