decent
This commit is contained in:
25
web-components/dist/hooks/useApiService.d.ts
vendored
Normal file
25
web-components/dist/hooks/useApiService.d.ts
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { FilterOptions } from '../types';
|
||||
export interface ApiServiceConfig {
|
||||
baseURL: string;
|
||||
defaultHeaders?: Record<string, string>;
|
||||
timeout?: number;
|
||||
}
|
||||
export interface UseApiServiceReturn<T> {
|
||||
data: T[];
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
total: number;
|
||||
hasMore: boolean;
|
||||
client: AxiosInstance;
|
||||
getAll: (filters?: FilterOptions) => Promise<T[]>;
|
||||
getById: (id: string) => Promise<T>;
|
||||
create: (data: Partial<T>) => Promise<T>;
|
||||
update: (id: string, data: Partial<T>) => Promise<T>;
|
||||
delete: (id: string) => Promise<void>;
|
||||
clearError: () => void;
|
||||
refresh: () => Promise<void>;
|
||||
}
|
||||
export declare const useApiService: <T extends {
|
||||
id: string;
|
||||
}>(config: ApiServiceConfig, endpoint: string) => UseApiServiceReturn<T>;
|
||||
Reference in New Issue
Block a user