uikit/dist/core.d.ts
2026-06-21 14:25:33 +03:30

26 lines
604 B
TypeScript

// ----- createApi -----
export type ApiAction = {
url?: string | ((id?: unknown, data?: any) => string);
method?: "get" | "post" | "put" | "patch" | "delete";
body?: (data: any) => any;
sendRawPayload?: boolean;
invalidateKeys?: any[] | ((responseData: any, variables: any) => any[]);
};
export type CreateApiConfig = {
key: string | unknown[];
url: string;
actions?: Record<string, ApiAction>;
axiosInstance?: any;
fetcher?: any;
};
export function createApi(config: CreateApiConfig): {
key: unknown[];
listKey: unknown[];
useGet: any;
useItem: any;
useAction: any;
};