UNPKG

local-fake-api

Version:

A simple async local mock API without backend.

25 lines (24 loc) 661 B
interface ApiResponse<T> { success: boolean; data?: T; error?: unknown; } interface UseRestApiProps<T> { queryId?: unknown; apiCall: () => Promise<ApiResponse<T>>; initValue?: T; willCall?: boolean; } declare function useRestApi<T = unknown>({ queryId, apiCall, initValue, willCall, }: UseRestApiProps<T>): { isLoading: boolean; isError: boolean; hasError: boolean; success: boolean; apiData: T | undefined; apiError: unknown; setApiData: import("react").Dispatch<import("react").SetStateAction<T | undefined>>; run: () => void; reCall: () => void; redo: () => void; }; export { useRestApi };