UNPKG

@replyke/core

Version:

Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.

21 lines (20 loc) 930 B
import { Entity } from "../../interfaces/models/Entity"; import { Comment } from "../../interfaces/models/Comment"; import { ReactionType, ReactionCounts } from "../../interfaces/models/Reaction"; export interface UseReactionToggleProps { targetType: "entity" | "comment"; targetId: string | undefined; initialReaction?: ReactionType | null | undefined; initialReactionCounts?: ReactionCounts | null | undefined; } export interface ToggleReactionProps { reactionType: ReactionType; } export interface UseReactionToggleValues { currentReaction: ReactionType | null; reactionCounts: Partial<ReactionCounts>; toggleReaction: (props: ToggleReactionProps) => Promise<Entity | Comment | null>; loading: boolean; } declare function useReactionToggle({ targetType, targetId, initialReaction, initialReactionCounts, }: UseReactionToggleProps): UseReactionToggleValues; export default useReactionToggle;