@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
36 lines (35 loc) • 1.16 kB
TypeScript
import { UpdateEntityProps } from "./useUpdateEntity";
import { Entity } from "../../interfaces/models/Entity";
export type UseEntityDataProps = {
entity: Entity;
entityId?: undefined;
foreignId?: undefined;
shortId?: undefined;
createIfNotFound?: undefined;
} | {
entity?: undefined;
entityId: string;
foreignId?: undefined;
shortId?: undefined;
createIfNotFound?: undefined;
} | {
entity?: undefined;
entityId?: undefined;
foreignId?: undefined;
shortId: string;
createIfNotFound?: undefined;
} | {
entity?: undefined;
entityId?: undefined;
foreignId: string;
shortId?: undefined;
createIfNotFound?: boolean;
};
export interface UseEntityDataValues {
entity: Entity | null | undefined;
setEntity: React.Dispatch<React.SetStateAction<Entity | null | undefined>>;
updateEntity(props: Pick<UpdateEntityProps, "update">): Promise<Entity | undefined>;
deleteEntity: () => Promise<void>;
}
declare function useEntityData({ entityId, foreignId, shortId, entity: entityProp, createIfNotFound, }: UseEntityDataProps): UseEntityDataValues;
export default useEntityData;