hooks/useSCJoinedCoursesManager
Functions
useSCJoinedCoursesManager()
useSCJoinedCoursesManager(
user?
): {courses
:any
[];emptyCache
:undefined
;isLoading
: (v
) =>boolean
;join
:undefined
;joinStatus
:undefined
;leave
:undefined
;loading
:any
[];refresh
:undefined
; } | {courses
:any
[];emptyCache
: () =>void
;isLoading
: (v
) =>boolean
;join
: (course
,userId?
) =>Promise
<any
>;joinStatus
: (course
) =>string
;leave
: (course
) =>Promise
<any
>;loading
:any
[];refresh
: () =>void
; }
This custom hook is used to manage the courses followed.
Follow these steps:
1. const scUserContext: SCUserContextType = useSCUser();
2. const scJoinedCoursesManager: SCJoinedCoursesManagerType = scUserContext.manager.courses;
3. scJoinedCoursesManager.isJoined(course)
Parameters
Parameter | Type |
---|---|
user? | SCUserType |
Returns
{ courses
: any
[]; emptyCache
: undefined
; isLoading
: (v
) => boolean
; join
: undefined
; joinStatus
: undefined
; leave
: undefined
; loading
: any
[]; refresh
: undefined
; } | { courses
: any
[]; emptyCache
: () => void
; isLoading
: (v
) => boolean
; join
: (course
, userId?
) => Promise
<any
>; joinStatus
: (course
) => string
; leave
: (course
) => Promise
<any
>; loading
: any
[]; refresh
: () => void
; }