zstoreq
Version:
zustand-query is a library that helps you to query You can cal your api and get the data and store it in zustand store
16 lines (15 loc) • 565 B
TypeScript
type CacheItem<T> = {
data: T | null;
error: any;
isLoading: boolean;
lastFetched: number | null;
fetchFn: () => Promise<T>;
};
type CacheStore = {
cache: Record<string, CacheItem<any>>;
fetchQuery: <T>(key: string, fetchFn: () => Promise<T>, staleTime?: number, onError?: (err: any) => void, retry?: boolean | number) => Promise<T>;
invalidateQuery: (key: string) => void;
invalidateAll: () => void;
};
export declare const useQueryCacheStore: import("zustand").UseBoundStore<import("zustand").StoreApi<CacheStore>>;
export {};