@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
42 lines (41 loc) • 1.64 kB
TypeScript
import { type SpaceListFilters, type SpaceListConfig, type SpaceListFetchOptions } from "../../store/slices/spaceListsSlice";
import { Space, ReadingPermission, PostingPermission } from "../../interfaces/models/Space";
import { SpaceListSortByOptions } from "../../interfaces/SpaceListSortByOptions";
export interface UseSpaceListProps {
listId: string;
}
export interface SpaceListCreateSpaceProps {
name: string;
slug?: string | null;
description?: string | null;
avatar?: string | null;
banner?: string | null;
readingPermission?: ReadingPermission;
postingPermission?: PostingPermission;
requireJoinApproval?: boolean;
metadata?: Record<string, any>;
parentSpaceId?: string | null;
insertPosition?: "first" | "last";
}
export interface SpaceListDeleteSpaceProps {
spaceId: string;
}
export interface UseSpaceListValues {
spaces: Space[];
loading: boolean;
hasMore: boolean;
sortBy: SpaceListSortByOptions | null;
searchSlug: string | null;
searchName: string | null;
searchDescription: string | null;
searchAny: string | null;
readingPermission: "anyone" | "members" | null;
memberOf: boolean;
parentSpaceId: string | null;
fetchSpaces: (filters: Partial<SpaceListFilters>, config?: SpaceListConfig, options?: SpaceListFetchOptions) => void;
loadMore: () => void;
createSpace: (props: SpaceListCreateSpaceProps) => Promise<Space | undefined>;
deleteSpace: (props: SpaceListDeleteSpaceProps) => Promise<void>;
}
declare function useSpaceList({ listId }: UseSpaceListProps): UseSpaceListValues;
export default useSpaceList;