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,
|
GetSubCoursePrerequisitesResponse,
|
||||||
AddSubCoursePrerequisiteRequest,
|
AddSubCoursePrerequisiteRequest,
|
||||||
GetLearningPathResponse,
|
GetLearningPathResponse,
|
||||||
|
GetSubModuleLessonDetailResponse,
|
||||||
GetHumanLanguageLessonsResponse,
|
GetHumanLanguageLessonsResponse,
|
||||||
GetHumanLanguageHierarchyResponse,
|
GetHumanLanguageHierarchyResponse,
|
||||||
CreateHumanLanguageLessonRequest,
|
CreateHumanLanguageLessonRequest,
|
||||||
|
|
@ -298,6 +299,9 @@ export const deleteSubModule = (subModuleId: number) =>
|
||||||
export const getVideosBySubModule = (subModuleId: number) =>
|
export const getVideosBySubModule = (subModuleId: number) =>
|
||||||
http.get<GetSubCourseVideosResponse>(`/course-management/sub-modules/${subModuleId}/videos`)
|
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) =>
|
export const createSubCourseVideo = (data: CreateSubCourseVideoRequest) =>
|
||||||
http.post("/course-management/sub-module-videos", {
|
http.post("/course-management/sub-module-videos", {
|
||||||
sub_module_id: data.sub_module_id ?? data.sub_course_id,
|
sub_module_id: data.sub_module_id ?? data.sub_course_id,
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ import {
|
||||||
getPracticeQuestions,
|
getPracticeQuestions,
|
||||||
getPracticeQuestionsByPractice,
|
getPracticeQuestionsByPractice,
|
||||||
getQuestionSetById,
|
getQuestionSetById,
|
||||||
|
getSubModuleLessonById,
|
||||||
updateQuestionSet,
|
updateQuestionSet,
|
||||||
updateQuestion,
|
updateQuestion,
|
||||||
} from "../../api/courses.api"
|
} from "../../api/courses.api"
|
||||||
|
|
@ -941,7 +942,7 @@ export function HumanLanguagePage() {
|
||||||
setLessonDialog({ open: true, lessonId: lesson.id, questionSetId: lesson.question_set_id })
|
setLessonDialog({ open: true, lessonId: lesson.id, questionSetId: lesson.question_set_id })
|
||||||
setSavingLesson(false)
|
setSavingLesson(false)
|
||||||
try {
|
try {
|
||||||
const detail = (await getQuestionSetById(lesson.question_set_id)).data?.data
|
const detail = (await getSubModuleLessonById(lesson.id)).data?.data
|
||||||
setLessonForm({
|
setLessonForm({
|
||||||
title: detail?.title ?? lesson.title ?? "",
|
title: detail?.title ?? lesson.title ?? "",
|
||||||
description: detail?.description ?? "",
|
description: detail?.description ?? "",
|
||||||
|
|
|
||||||
|
|
@ -702,6 +702,28 @@ export interface HumanLanguageLesson {
|
||||||
practices: LearningPathPractice[]
|
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 {
|
export interface GetHumanLanguageLessonsResponse {
|
||||||
message: string
|
message: string
|
||||||
data: {
|
data: {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user