UNPKG

@selfcommunity/react-core

Version:

React Core Components useful for integrating UI Community components (react-ui).

39 lines (37 loc) 1.09 kB
import { SCGroupType, SCUserType } from '@selfcommunity/types'; /** :::info This custom hook is used to manage the groups followed. ::: :::tip How to use it: Follow these steps: ```jsx 1. const scUserContext: SCUserContextType = useSCUser(); 2. const scSubscribedGroupsManager: SCSubscribedGroupsManagerType = scUserContext.manager.groups; 3. scSubscribedGroupsManager.isSubscribed(group) ``` ::: */ export default function useSCSubscribedGroupsManager(user?: SCUserType): { groups: any[]; loading: any[]; isLoading: (v: number | { id: number; }) => boolean; subscribe?: undefined; unsubscribe?: undefined; subscriptionStatus?: undefined; refresh?: undefined; emptyCache?: undefined; } | { groups: any[]; loading: any[]; isLoading: (v: number | { id: number; }) => boolean; subscribe: (group: SCGroupType, userId?: number) => Promise<any>; unsubscribe: (group: SCGroupType) => Promise<any>; subscriptionStatus: (group: SCGroupType) => string; refresh: () => void; emptyCache: () => void; };