import {showLoadingToast, closeToast, showToast} from 'vant';
import axios from "axios";
import storage from '@/utils/storage.js';
const request = axios.create({
    baseURL:import.meta.env.VITE_APP_API_BASE_URL,
    timeout:5000
});
request.interceptors.request.use((config)=>{
    config.headers.Authorization =storage.getItem('token')
    showLoadingToast({
        duration:5000,
        message: '加载中...',
        forbidClick: true,
        className:'particulars-detail-popup'
    });
    return config;
});
request.interceptors.response.use((res)=>{
    closeToast()
    if (res.data.status!==0){
        console.log(res.data.msg)
        showToast({
            message:res.data.msg,
            className: 'particulars-detail-popup'
        });
    }
    return res.data;
},()=>{

});
export default request;
