UNPKG

react-use-api

Version:

<div align="center"> <h1> <img width="120" src="./icon.svg"> <br/> React useApi() <br /> <br /> </h1> </div>

33 lines (32 loc) 1.53 kB
import { AxiosStatic, AxiosInstance } from 'axios'; import LRU from 'lru-cache'; export declare const defaultSettings: { cache: LRU<string, any>; axios: AxiosStatic | AxiosInstance; maxRequests: number; useCacheData: boolean; alwaysUseCache: boolean; clearLastCacheWhenConfigChanges: boolean; debug: boolean; clientCacheVar: string; isSSR: (...args: any[]) => boolean | void; renderSSR: (...args: any[]) => string; shouldUseApiCache: (config?: ReactUseApi.Config, cacheKey?: string) => boolean | void; }; export declare const ACTIONS: { REQUEST_START: string; REQUEST_END: string; }; export declare const initState: { loading: boolean; fromCache: boolean; $cacheKey: string; }; export declare const configure: (context: ReactUseApi.CustomContext, isSSR?: boolean) => import("./typings").Context; export declare function axiosAll(context: ReactUseApi.Context, config: ReactUseApi.Config): Promise<ReactUseApi.ApiResponse>; export declare function axiosAll(context: ReactUseApi.Context, config: ReactUseApi.MultiConfigs): Promise<ReactUseApi.ApiResponse[]>; export declare const tidyResponse: (response: ReactUseApi.ApiResponse) => import("./typings").ApiResponse; export declare const getResponseData: (options: ReactUseApi.Options, state: ReactUseApi.State) => import("./typings").JsonObject; export declare const isObject: (target: any) => boolean; export declare const isFunction: (target: any) => boolean; export declare const isNil: (value: any) => boolean;