UNPKG

react-native-hook-api-call

Version:
15 lines (14 loc) 542 B
import { AxiosInstance } from 'axios'; type HttpMethod = 'get' | 'post' | 'put' | 'delete'; interface UseApiOptions { manual?: boolean; params?: Record<string, any>; } declare function useApi<T = any>(endpoint: string, method: HttpMethod | undefined, options: UseApiOptions | undefined, axiosInstance: AxiosInstance): { data: T | null; loading: boolean; error: string | null; refetch: (payload?: Record<string, any>) => Promise<void>; LoaderComponent: import("react").JSX.Element | null; }; export default useApi;