UNPKG

@selfcommunity/react-core

Version:

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

39 lines (37 loc) 1.03 kB
import { SCCourseType, SCUserType } from '@selfcommunity/types'; /** :::info This custom hook is used to manage the courses followed. ::: :::tip How to use it: Follow these steps: ```jsx 1. const scUserContext: SCUserContextType = useSCUser(); 2. const scJoinedCoursesManager: SCJoinedCoursesManagerType = scUserContext.manager.courses; 3. scJoinedCoursesManager.isJoined(course) ``` ::: */ export default function useSCJoinedCoursesManager(user?: SCUserType): { courses: any[]; loading: any[]; isLoading: (v: number | { id: number; }) => boolean; join?: undefined; leave?: undefined; joinStatus?: undefined; refresh?: undefined; emptyCache?: undefined; } | { courses: any[]; loading: any[]; isLoading: (v: number | { id: number; }) => boolean; join: (course: SCCourseType) => Promise<any>; leave: (course: SCCourseType) => Promise<any>; joinStatus: (course: SCCourseType) => string; refresh: () => void; emptyCache: () => void; };