fix human language quick-create path creation
Create a real sub-category under Human Language and pass sub_category_id when creating the course so the new path renders immediately in the hierarchy panel. Made-with: Cursor
This commit is contained in:
parent
24b5a0d7ee
commit
5206fb2e1a
|
|
@ -628,10 +628,20 @@ export function HumanLanguagePage() {
|
|||
if (!effectiveCategoryId) {
|
||||
throw new Error("Missing human language category id")
|
||||
}
|
||||
const title = `${quickSubCategoryName.trim()} - ${quickCourseName.trim()}`
|
||||
|
||||
const createdSubCategory = await createCourseCategory({
|
||||
name: quickSubCategoryName.trim(),
|
||||
parent_id: effectiveCategoryId,
|
||||
})
|
||||
const subCategoryId = createdSubCategory.data?.data?.id
|
||||
if (!subCategoryId) {
|
||||
throw new Error("Failed to create subcategory")
|
||||
}
|
||||
|
||||
await createCourse({
|
||||
category_id: effectiveCategoryId,
|
||||
title,
|
||||
sub_category_id: Number(subCategoryId),
|
||||
title: quickCourseName.trim(),
|
||||
description: `${quickSubCategoryName.trim()} / ${quickCourseName.trim()}`,
|
||||
})
|
||||
toast.success("Subcategory/course path created")
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ export interface GetCoursesResponse {
|
|||
|
||||
export interface CreateCourseRequest {
|
||||
category_id: number
|
||||
sub_category_id?: number | null
|
||||
title: string
|
||||
description: string
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user