cloudhospital.react.sdk
Version:
### Build local package
33 lines (32 loc) • 2.21 kB
TypeScript
import { SWRConfiguration } from 'swr';
import { SWRMutationConfiguration } from 'swr/mutation';
import { SWRInfiniteConfiguration } from 'swr/infinite';
import { PagedListMetaData } from 'ch-api-client-typescript2/lib/models/paged-list-meta-data';
export declare const nameOf: (f: () => any, returnesFullName?: boolean) => string;
export declare const useGenericSWR: <TResponse, TError, TPayload>(key: string, api: (payload: TPayload) => Promise<TResponse>, payload: TPayload, shouldFetch?: boolean, config?: Partial<import("swr/_internal").PublicConfiguration<TResponse, TError, import("swr/_internal").BareFetcher<any>>> | undefined) => {
data: TResponse | undefined;
error: TError | undefined;
mutate: import("swr/_internal").KeyedMutator<TResponse>;
isValidating: boolean;
isLoading: boolean;
};
export declare const useGenericSWRMutation: <TResponse, TError, TPayload>(key: string, api: (payload: TPayload) => Promise<TResponse>, config?: SWRMutationConfiguration<TResponse, TError, any, string> | undefined) => {
data: TResponse | undefined;
error: TError | undefined;
trigger: [TPayload] extends [never] ? import("swr/mutation").TriggerWithoutArgs<TResponse, TError, any, TPayload> : (undefined extends TPayload ? true : false) extends true ? import("swr/mutation").TriggerWithOptionsArgs<TResponse, TError, any, TPayload> : import("swr/mutation").TriggerWithArgs<TResponse, TError, any, TPayload>;
reset: () => void;
isMutating: boolean;
};
export declare const useGenericSWRInfinite: <TResponse extends {
items?: any[] | null | undefined;
metaData?: PagedListMetaData | undefined;
}, TError, TPayload extends {
page?: number | undefined;
}>(key: string, api: (option: TPayload) => Promise<TResponse>, payload: TPayload | undefined, shouldFetch?: boolean, config?: SWRInfiniteConfiguration<TResponse, TError, import("swr/_internal").BareFetcher<TResponse>> | undefined) => {
data: TResponse | undefined;
isValidating: boolean;
isLoading: boolean;
error: TError | undefined;
setSize: (size: number | ((_size: number) => number)) => Promise<TResponse[] | undefined>;
mutate: import("swr/_internal").KeyedMutator<TResponse[]>;
};