updated some of things

This commit is contained in:
rgrgogu
2026-08-03 12:03:11 +08:00
parent 1315796412
commit 6be0c29850
75 changed files with 1743 additions and 1702 deletions
@@ -1,4 +1,4 @@
import { useMemo, useRef, useState } from "react";
import { useMemo, useRef, useState, useEffect } from "react";
import { useNavigate } from "react-router-dom";
import api from "@/utils/api.util";
@@ -38,6 +38,17 @@ export default function CoursesTable() {
tableRefsRef.current = refs;
};
const [tierCategories, setTierCategories] = useState([]);
useEffect(() => {
api.get("/admin/tiers/categories")
.then(({ data }) => setTierCategories(data.data ?? []))
.catch(() => {});
}, []);
const tierMap = useMemo(
() => Object.fromEntries(tierCategories.map((c) => [c.slug, c])),
[tierCategories]
);
const exportConfig = {
allData: courses,
attributes,
@@ -90,8 +101,8 @@ export default function CoursesTable() {
});
const columns = useMemo(
() => buildDataColumns(attributes, rowActions),
[attributes, rowActions]
() => buildDataColumns(attributes, rowActions, tierMap),
[attributes, rowActions, tierMap]
);
const handleArchiveSuccess = () => {