mirror of
https://github.com/sergeyyarkov/educt-client.git
synced 2026-10-11 10:19:22 +03:00
fix: do not change lesson order on deleting last lesson in course
This commit is contained in:
parent
7d9a9f7d19
commit
e64d588833
@ -46,7 +46,7 @@ const CoursePage: React.FC<IPageProps> = () => {
|
|||||||
const isEmptyLessons = course.lessons.length === 0;
|
const isEmptyLessons = course.lessons.length === 0;
|
||||||
const isEmptyStudents = course.students.length === 0;
|
const isEmptyStudents = course.students.length === 0;
|
||||||
|
|
||||||
const handleWatchCourse = () => history.push(`/lesson/${course.lessons[0].id}`);
|
const handleWatchCourse = () => course.lessons[0] && history.push(`/lesson/${course.lessons[0].id}`);
|
||||||
|
|
||||||
const handleEditCourse = () => history.push(`/courses/edit/${course.id}`);
|
const handleEditCourse = () => history.push(`/courses/edit/${course.id}`);
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ const CoursePage: React.FC<IPageProps> = () => {
|
|||||||
<Box>
|
<Box>
|
||||||
{(me.isAdmin || me.isTeacher) && <EditButton onClick={handleEditCourse} mr='2' />}
|
{(me.isAdmin || me.isTeacher) && <EditButton onClick={handleEditCourse} mr='2' />}
|
||||||
<Button
|
<Button
|
||||||
isDisabled={!isCourseAvailable}
|
isDisabled={!isCourseAvailable || course.lessons[0] === undefined}
|
||||||
onClick={handleWatchCourse}
|
onClick={handleWatchCourse}
|
||||||
leftIcon={<MdPlayCircleOutline />}
|
leftIcon={<MdPlayCircleOutline />}
|
||||||
size='sm'
|
size='sm'
|
||||||
@ -133,7 +133,7 @@ const CoursePage: React.FC<IPageProps> = () => {
|
|||||||
<Text fontSize={'2xl'} fontWeight={'medium'}>
|
<Text fontSize={'2xl'} fontWeight={'medium'}>
|
||||||
What you'll learn.
|
What you'll learn.
|
||||||
</Text>
|
</Text>
|
||||||
<Text fontSize={'sm'} mt='2'>
|
<Text fontSize={'sm'} mt='2' textAlign={'justify'}>
|
||||||
{course.education_description}
|
{course.education_description}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@ -69,6 +69,7 @@ const LessonList: React.FC<LessonListPropsType> = ({ course }) => {
|
|||||||
|
|
||||||
const handleChangeOrder = async (ids: string[]) => {
|
const handleChangeOrder = async (ids: string[]) => {
|
||||||
try {
|
try {
|
||||||
|
if (ids.length <= 0) return;
|
||||||
const data = await LessonServiceInstance.saveOrder(ids);
|
const data = await LessonServiceInstance.saveOrder(ids);
|
||||||
return data;
|
return data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user