From 496285cfe345fcd80221208deb83db6a173fb295 Mon Sep 17 00:00:00 2001 From: Andrei Liviu Georgescu <146103342+andreilgeorgescu@users.noreply.github.com> Date: Tue, 29 Oct 2024 13:10:22 +0000 Subject: [PATCH] Fix type errors --- src/components/CourseCurriculumHelper.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/CourseCurriculumHelper.tsx b/src/components/CourseCurriculumHelper.tsx index 52da7f63..127f2642 100644 --- a/src/components/CourseCurriculumHelper.tsx +++ b/src/components/CourseCurriculumHelper.tsx @@ -30,6 +30,10 @@ export default function Example(props: Props) { course_id: number; } + interface CourseResponse { + updatedLectureSections: LectureSection[]; + } + interface Attachment { id: number; name?: string; @@ -191,7 +195,8 @@ export default function Example(props: Props) { // }; const call = async () => { const response = await fetch(`/api/purchase/${props.pricingPlanId}`); - lectureSectionData = response.json().updatedLectureSections; + const course: CourseResponse = (await response.json()) as CourseResponse; + lectureSectionData = course.updatedLectureSections; if (lectureSectionData.length === 1) { setLectureSections(lectureSectionData); setLoading(false);