Skip to content

Commit

Permalink
changed section_id
Browse files Browse the repository at this point in the history
  • Loading branch information
OlyaKorchan committed Nov 1, 2023
1 parent 7429da2 commit 3d5552c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/containers/course-section/CourseSectionContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const CourseSectionContainer: FC<SectionProps> = ({

const onDeleteSection = () => {
setSectionsItems((prev) => {
return prev.filter((item) => item.section_id !== sectionData.section_id)
return prev.filter((item) => item.id !== sectionData.id)
})
}

Expand Down
6 changes: 1 addition & 5 deletions src/containers/course-sections-list/CourseSectionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ const CourseSectionsList: FC<CourseSectionsListProps> = ({
}

const sectionsList = items.map((item, i) => (
<Draggable
draggableId={item.section_id.toString()}
index={i}
key={item.section_id}
>
<Draggable draggableId={item.id.toString()} index={i} key={item.id}>
{(provided: DraggableProvided, snapshot: DraggableStateSnapshot) => (
<Box
ref={provided.innerRef}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/create-course/CreateCourse.constants.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const sectionInitialData = {
section_id: 0,
id: 0,
title: '',
description: '',
resources: []
Expand Down
2 changes: 1 addition & 1 deletion src/pages/create-course/CreateCourse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const CreateCourse = () => {

const createNewSection = () => {
const newSectionData = { ...sectionInitialData }
newSectionData.section_id = sectionsItems.length
newSectionData.id = sectionsItems.length
setSectionsItems([...sectionsItems, newSectionData])
}

Expand Down
2 changes: 1 addition & 1 deletion src/types/course/interfaces/course.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface Course extends CommonEntityFields {
}

export interface CourseSection {
section_id: number
id: number
title: string
description: string
resources: (Lesson | Quiz | Attachment)[]
Expand Down

0 comments on commit 3d5552c

Please sign in to comment.