query-harbor
Version:
A React Query utility package for efficient data fetching and caching
25 lines • 800 B
TypeScript
import { AxiosRequestHeaders, AxiosResponse } from 'axios';
interface ActionHandlerParams {
action: "GET" | "POST" | "PUT" | "DELETE";
url: string;
data?: any;
headers?: AxiosRequestHeaders;
}
export interface ApiSuccessResponse {
status: true;
data: any;
message?: string;
statusCode: number;
}
interface ApiErrorResponse {
status: false;
error: string;
message: string;
statusCode?: number;
type?: string;
}
type ApiResponse = ApiSuccessResponse | ApiErrorResponse;
export declare const ActionHandler: ({ action, url, data, headers }: ActionHandlerParams) => Promise<AxiosResponse>;
export declare const APIHandler: ({ action, url, data, headers }: ActionHandlerParams) => Promise<ApiResponse>;
export {};
//# sourceMappingURL=apiHandler.d.ts.map