UNPKG

@replyke/core

Version:

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

53 lines (52 loc) 1.71 kB
import type { Entity } from "../../interfaces/models/Entity"; import type { Collection } from "../../interfaces/models/Collection"; export interface UseCollectionsProps { } export interface CreateCollectionProps { collectionName: string; } export interface UpdateCollectionProps { collectionId: string; update: Partial<{ name: string; }>; } export interface DeleteCollectionProps { collection: Collection; } export interface AddToCollectionProps { entity: Entity; } export interface RemoveFromCollectionProps { entityId: string; } export interface UseCollectionsValues { currentCollection: Collection | null; subCollections: Collection[]; loading: boolean; openCollection: (collection: Collection) => void; goBack: () => void; goToRoot: () => void; isEntitySaved: (props: { entityId: string; collectionId?: string; }) => Promise<{ saved: boolean; inSpecificCollection?: boolean; collections: Array<{ id: string; name: string; }>; }>; createCollection: (props: CreateCollectionProps) => Promise<void>; updateCollection: (props: UpdateCollectionProps) => Promise<void>; deleteCollection: (props: DeleteCollectionProps) => Promise<void>; addToCollection: (props: AddToCollectionProps) => Promise<void>; removeFromCollection: (props: RemoveFromCollectionProps) => Promise<void>; } /** * Redux-powered hook that provides the exact same interface as useCollectionsData() * This is a drop-in replacement for the Context-based hook */ declare function useCollections(_?: UseCollectionsProps): UseCollectionsValues; export default useCollections;