diff --git a/src/api/courses.api.ts b/src/api/courses.api.ts index 9c77a29..d0f3cf8 100644 --- a/src/api/courses.api.ts +++ b/src/api/courses.api.ts @@ -631,8 +631,12 @@ export const getHumanLanguageLessonsByCourse = (courseId: number, cefr_level: st params: { cefr_level }, }) -export const getHumanLanguageHierarchy = () => - withSingleRetry(() => http.get("/course-management/hierarchy")).then(async (res) => { +export const getHumanLanguageHierarchy = (options?: { cacheBust?: boolean }) => + withSingleRetry(() => + http.get("/course-management/hierarchy", { + params: options?.cacheBust ? { _t: Date.now() } : undefined, + }), + ).then(async (res) => { const payload = res.data?.data as unknown if (payload && typeof payload === "object" && !Array.isArray(payload) && "sub_categories" in payload) { return res diff --git a/src/pages/content-management/HumanLanguagePage.tsx b/src/pages/content-management/HumanLanguagePage.tsx index a4a2c81..9c4d4bf 100644 --- a/src/pages/content-management/HumanLanguagePage.tsx +++ b/src/pages/content-management/HumanLanguagePage.tsx @@ -426,10 +426,10 @@ export function HumanLanguagePage() { label?: string, ) => - const loadHierarchy = async (showLoading = true) => { + const loadHierarchy = async (showLoading = true, forceRefresh = false) => { if (showLoading) setLoading(true) try { - const res = await getHumanLanguageHierarchy() + const res = await getHumanLanguageHierarchy({ cacheBust: forceRefresh }) const data = res.data?.data setCategoryId(data?.category_id ?? null) const nextSubCategories = data?.sub_categories ?? [] @@ -1078,7 +1078,7 @@ export function HumanLanguagePage() { }) toast.success("Lesson updated") setLessonDialog({ open: false }) - await loadHierarchy(false) + await loadHierarchy(false, true) } catch (error) { console.error("Failed to update lesson:", error) toast.error("Failed to update lesson")