UNPKG

@firecms/core

Version:

Awesome Firebase/Firestore-based headless open-source CMS

30 lines (29 loc) 934 B
import { Entity, EntityCollection, User } from "../../types"; /** * @group Hooks and utilities */ export interface EntityFetchProps<M extends Record<string, any>, USER extends User = User> { path: string; entityId?: string; databaseId?: string; collection: EntityCollection<M, USER>; useCache?: boolean; } /** * @group Hooks and utilities */ export interface EntityFetchResult<M extends Record<string, any>> { entity?: Entity<M>; dataLoading: boolean; dataLoadingError?: Error; } /** * This hook is used to fetch an entity. * It gives real time updates if the datasource supports it. * @param path * @param collection * @param entityId * @param useCache * @group Hooks and utilities */ export declare function useEntityFetch<M extends Record<string, any>, USER extends User>({ path: inputPath, entityId, collection, databaseId, useCache }: EntityFetchProps<M, USER>): EntityFetchResult<M>;