UNPKG

@pwc-ra/components

Version:

PwC RA shared components library

28 lines (27 loc) 1.17 kB
import type { AxiosResponse, AxiosRequestConfig } from 'axios'; interface CustomRequestConfig { /** * 控制数据格式转换行为 * - true: 启用数据格式转换 * - false: 禁用数据格式转换 * - 默认为 true */ transformKeys?: boolean; /** * 是否等待Keycloak初始化 * - true: 等待Keycloak初始化完成后再发送请求 * - false: 不等待Keycloak初始化,直接发送请求 * - 默认为 true */ waitForAuth?: boolean; } type ExtendedRequestConfig = AxiosRequestConfig & CustomRequestConfig; export declare const setAutoTransformKeys: (enabled: boolean) => void; export declare const setWaitForAuth: (enabled: boolean) => void; export declare const http: { get: <T>(url: string, config?: ExtendedRequestConfig) => Promise<AxiosResponse<T, any>>; post: <T>(url: string, data?: any, config?: ExtendedRequestConfig) => Promise<AxiosResponse<T, any>>; put: <T>(url: string, data?: any, config?: ExtendedRequestConfig) => Promise<AxiosResponse<T, any>>; delete: <T>(url: string, config?: ExtendedRequestConfig) => Promise<AxiosResponse<T, any>>; }; export {};