UNPKG

react-antd-admin-panel

Version:

Modern TypeScript-first React admin panel builder with Ant Design 6

76 lines 1.94 kB
import { AxiosInstance } from 'axios'; import type { RequestConfig } from '../types'; /** * Get Model - Type-safe HTTP GET request builder * @template T - Response data type */ export declare class Get<T = any> { private _target?; private _params; private _headers; private _config; private _hooks; private _abortController?; private static _axios; /** * Set the request target URL */ target(url: string): this; /** * Set URL parameters */ params(params: Record<string, any>): this; /** * Set a single URL parameter */ param(key: string, value: any): this; /** * Set request headers */ headers(headers: Record<string, string>): this; /** * Set a single header */ header(key: string, value: string): this; /** * Set additional request configuration */ config(config: Partial<RequestConfig>): this; /** * Hook called before the request is sent */ onBefore(callback: (config: RequestConfig) => RequestConfig | Promise<RequestConfig>): this; /** * Hook called when request succeeds */ onThen(callback: (data: T) => void | Promise<void>): this; /** * Hook called when request fails */ onCatch(callback: (error: Error) => any): this; /** * Hook called after request completes (success or failure) */ onFinally(callback: () => void | Promise<void>): this; /** * Execute the GET request */ execute(): Promise<T>; /** * Cancel the request */ cancel(message?: string): void; /** * Set global axios instance */ static setAxios(instance: AxiosInstance): void; /** * Get the current axios instance */ static getAxios(): AxiosInstance; /** * Configure global defaults */ static configure(config: RequestConfig): void; } //# sourceMappingURL=Get.d.ts.map