mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: unpublished activities are now hidden by default
This commit is contained in:
parent
e6d7e881e3
commit
46e06201fb
14 changed files with 83 additions and 42 deletions
|
|
@ -10,7 +10,7 @@ import { mutate } from 'swr'
|
|||
import { getAPIUrl } from '@services/config/config'
|
||||
import { revalidateTags } from '@services/utils/ts/requests'
|
||||
import { useLHSession } from '@components/Contexts/LHSessionContext'
|
||||
|
||||
import { useCourse } from '@components/Contexts/CourseContext'
|
||||
interface ModifiedChapterInterface {
|
||||
chapterId: string
|
||||
chapterName: string
|
||||
|
|
@ -25,6 +25,8 @@ function Chapter(props: any) {
|
|||
const [selectedChapter, setSelectedChapter] = React.useState<
|
||||
string | undefined
|
||||
>(undefined)
|
||||
const course = useCourse() as any;
|
||||
const withUnpublishedActivities = course ? course.withUnpublishedActivities : false
|
||||
|
||||
async function updateChapterName(chapterId: string) {
|
||||
if (modifiedChapter?.chapterId === chapterId) {
|
||||
|
|
@ -32,7 +34,7 @@ function Chapter(props: any) {
|
|||
name: modifiedChapter.chapterName,
|
||||
}
|
||||
await updateChapter(chapterId, modifiedChapterCopy, session.data?.tokens?.access_token)
|
||||
await mutate(`${getAPIUrl()}chapters/course/${props.course_uuid}/meta`)
|
||||
await mutate(`${getAPIUrl()}chapters/course/${props.course_uuid}/meta?with_unpublished_activities=${withUnpublishedActivities}`)
|
||||
await revalidateTags(['courses'], props.orgslug)
|
||||
router.refresh()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue