赞
踩
- import axios from 'axios';
- import { showMessage } from './status' // 接口请求失败的状态码
- import { ElMessage, ElLoading } from 'element-plus'
-
- let loading: any = null
- const loadingConfig = { // ElLoading 的加载动画
- lock: true,
- text: 'Loading',
- background: 'rgba(0, 0, 0, 0.7)'
- }
- console.log(localStorage.getItem("token"));
-
- const service = axios.create({
- baseURL: import.meta.env.VITE_BASE_URL + '/', // url = base url + request url
- timeout: 600000,
- withCredentials: true, // send cookies when cross-domain requests
- // headers: {
- // "Cache-Control": "no-cache",
- // Pragma: "no-cache",
- // },
- })
- declare module "axios" {
- interface AxiosResponse<T = any> {
- errorinfo: null;
- // 这里追加你的参数
- }
- export function create(config?: AxiosRequestConfig): AxiosInstance;
- }
-
- const loadingWhiteList = ['/trade/pay/send/result/search'] // 请求白名单
- // axios实例拦截请求
- service.interceptors.request.use(
- config => {
- console.log("声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/82158推荐阅读
相关标签
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。