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