mirror of
https://github.com/sergeyyarkov/educt-client.git
synced 2026-10-11 02:09:08 +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 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}`);
|
||||
|
||||
@ -74,7 +74,7 @@ const CoursePage: React.FC<IPageProps> = () => {
|
||||
<Box>
|
||||
{(me.isAdmin || me.isTeacher) && <EditButton onClick={handleEditCourse} mr='2' />}
|
||||
<Button
|
||||
isDisabled={!isCourseAvailable}
|
||||
isDisabled={!isCourseAvailable || course.lessons[0] === undefined}
|
||||
onClick={handleWatchCourse}
|
||||
leftIcon={<MdPlayCircleOutline />}
|
||||
size='sm'
|
||||
@ -133,7 +133,7 @@ const CoursePage: React.FC<IPageProps> = () => {
|
||||
<Text fontSize={'2xl'} fontWeight={'medium'}>
|
||||
What you'll learn.
|
||||
</Text>
|
||||
<Text fontSize={'sm'} mt='2'>
|
||||
<Text fontSize={'sm'} mt='2' textAlign={'justify'}>
|
||||
{course.education_description}
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
@ -69,6 +69,7 @@ const LessonList: React.FC<LessonListPropsType> = ({ course }) => {
|
||||
|
||||
const handleChangeOrder = async (ids: string[]) => {
|
||||
try {
|
||||
if (ids.length <= 0) return;
|
||||
const data = await LessonServiceInstance.saveOrder(ids);
|
||||
return data;
|
||||
} catch (error) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user