import { RaRecord } from '../../types'; import { UseGetOneHookValue, UseGetOneOptions } from '../../dataProvider'; /** * Prepare data for the Show view. * * useShowController does a few things: * - it grabs the id from the URL and the resource name from the ResourceContext, * - it fetches the record via useGetOne, * - it prepares the page title. * * @param {Object} props The props passed to the Show component. * * @return {Object} controllerProps Fetched data and callbacks for the Show view * * @example * * import { useShowController } from 'react-admin'; * import ShowView from './ShowView'; * * const MyShow = () => { * const controllerProps = useShowController(); * return ; * }; * * @example // useShowController can also take its parameters from props * * import { useShowController } from 'react-admin'; * import ShowView from './ShowView'; * * const MyShow = () => { * const controllerProps = useShowController({ resource: 'posts', id: 1234 }); * return ; * }; */ export declare const useShowController: (props?: ShowControllerProps) => ShowControllerResult; export interface ShowControllerProps { disableAuthentication?: boolean; id?: RecordType['id']; queryOptions?: UseGetOneOptions; resource?: string; } export interface ShowControllerBaseResult { defaultTitle?: string; isFetching: boolean; isLoading: boolean; resource: string; record?: RecordType; refetch: UseGetOneHookValue['refetch']; } export interface ShowControllerLoadingResult extends ShowControllerBaseResult { record: undefined; error: null; isPending: true; } export interface ShowControllerLoadingErrorResult extends ShowControllerBaseResult { record: undefined; error: TError; isPending: false; } export interface ShowControllerRefetchErrorResult extends ShowControllerBaseResult { record: RecordType; error: TError; isPending: false; } export interface ShowControllerSuccessResult extends ShowControllerBaseResult { record: RecordType; error: null; isPending: false; } export type ShowControllerResult = ShowControllerLoadingResult | ShowControllerLoadingErrorResult | ShowControllerRefetchErrorResult | ShowControllerSuccessResult; //# sourceMappingURL=useShowController.d.ts.map