use lesson detail endpoint for human language edits
Load human language lesson edit data from the dedicated sub-module lesson detail API so lesson metadata stays aligned with the backend response shape. Made-with: Cursor
This commit is contained in:
parent
bf76f729aa
commit
dc9b7f9d12
|
|
@ -47,6 +47,7 @@ import type {
|
|||
GetSubCoursePrerequisitesResponse,
|
||||
AddSubCoursePrerequisiteRequest,
|
||||
GetLearningPathResponse,
|
||||
GetSubModuleLessonDetailResponse,
|
||||
GetHumanLanguageLessonsResponse,
|
||||
GetHumanLanguageHierarchyResponse,
|
||||
CreateHumanLanguageLessonRequest,
|
||||
|
|
@ -298,6 +299,9 @@ export const deleteSubModule = (subModuleId: number) =>
|
|||
export const getVideosBySubModule = (subModuleId: number) =>
|
||||
http.get<GetSubCourseVideosResponse>(`/course-management/sub-modules/${subModuleId}/videos`)
|
||||
|
||||
export const getSubModuleLessonById = (lessonId: number) =>
|
||||
http.get<GetSubModuleLessonDetailResponse>(`/course-management/sub-module-lessons/${lessonId}`)
|
||||
|
||||
export const createSubCourseVideo = (data: CreateSubCourseVideoRequest) =>
|
||||
http.post("/course-management/sub-module-videos", {
|
||||
sub_module_id: data.sub_module_id ?? data.sub_course_id,
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ import {
|
|||
getPracticeQuestions,
|
||||
getPracticeQuestionsByPractice,
|
||||
getQuestionSetById,
|
||||
getSubModuleLessonById,
|
||||
updateQuestionSet,
|
||||
updateQuestion,
|
||||
} from "../../api/courses.api"
|
||||
|
|
@ -941,7 +942,7 @@ export function HumanLanguagePage() {
|
|||
setLessonDialog({ open: true, lessonId: lesson.id, questionSetId: lesson.question_set_id })
|
||||
setSavingLesson(false)
|
||||
try {
|
||||
const detail = (await getQuestionSetById(lesson.question_set_id)).data?.data
|
||||
const detail = (await getSubModuleLessonById(lesson.id)).data?.data
|
||||
setLessonForm({
|
||||
title: detail?.title ?? lesson.title ?? "",
|
||||
description: detail?.description ?? "",
|
||||
|
|
|
|||
|
|
@ -702,6 +702,28 @@ export interface HumanLanguageLesson {
|
|||
practices: LearningPathPractice[]
|
||||
}
|
||||
|
||||
export interface SubModuleLessonDetail {
|
||||
id: number
|
||||
sub_module_id: number
|
||||
question_set_id: number
|
||||
intro_video_url?: string | null
|
||||
display_order: number
|
||||
is_active: boolean
|
||||
title: string
|
||||
description?: string | null
|
||||
status: string
|
||||
set_type: string
|
||||
question_count: number
|
||||
}
|
||||
|
||||
export interface GetSubModuleLessonDetailResponse {
|
||||
message: string
|
||||
data: SubModuleLessonDetail
|
||||
success: boolean
|
||||
status_code: number
|
||||
metadata: unknown
|
||||
}
|
||||
|
||||
export interface GetHumanLanguageLessonsResponse {
|
||||
message: string
|
||||
data: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user