UNPKG

@dcp-designable/utils

Version:

工具类

31 lines (30 loc) 975 B
/** * @file ajax请求统一封装 * @author lishuna * @createDate 2025-03-24 08:35:44 * @LastModifiedBy lishuna * @LastModifiedTime 2025-03-24 08:35:44 * @desc */ import type { AxiosInstance, AxiosRequestConfig } from 'axios'; import type { AjaxResponse } from './types'; type IRequestConfig = AxiosRequestConfig & { cancelable?: boolean; lockable?: boolean; }; type IAxiosInstance = Omit<AxiosInstance, 'get' | 'post'> & { get: <T = any, R = AjaxResponse<T>>(url: string, config?: IRequestConfig) => Promise<R>; post: <T = any, R = AjaxResponse<T>>(url: string, data?: any, config?: IRequestConfig) => Promise<R>; }; interface IRequestHeader { authorization: string; QFCTid: string; QFCSid: string; lang: string; userAgent: string; gray?: string; } declare function getConfigHeaders(): IRequestHeader; declare const instance: IAxiosInstance; export { getConfigHeaders }; export default instance;