This commit is contained in:
2025-08-31 23:27:52 -04:00
parent 23dfc171b8
commit 40f8780dec
27 changed files with 24228 additions and 0 deletions

View 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>;

View File

@ -0,0 +1,16 @@
import { FilterOptions, ListItem } from '../types';
export interface UseDataFilterOptions {
searchFields?: string[];
defaultFilters?: FilterOptions;
debounceMs?: number;
}
export interface UseDataFilterReturn {
filteredData: ListItem[];
filters: FilterOptions;
setFilter: (key: string, value: any) => void;
clearFilters: () => void;
resetFilters: () => void;
searchTerm: string;
setSearchTerm: (term: string) => void;
}
export declare const useDataFilter: (data: ListItem[], options?: UseDataFilterOptions) => UseDataFilterReturn;