Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { noop } from 'lodash'
import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from 'react'
import { NavigateFunction, useNavigate, useSearchParams } from 'react-router-dom'
import classNames from 'classnames'

import { Button, UserProfile } from '../../../../lib'
import { UserProfile } from '../../../../lib'
import {
CourseOutline,
LearnCourse,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ export function useGetCourses(

const { data, error }: SWRResponse<ReadonlyArray<LearnCourse>> = useSWR(url, swrCacheConfig)

const course: LearnCourse | undefined = get(data, [0])

// sort modules by order property
course?.modules.sort((mA, mB) => mA.order - mB.order)

return {
course: get(data, [0]),
course,
loading: !data && !error,
ready: !!data || !!error,
}
Expand Down