refactor: simplify loaderData usage in dashboard categories and contents pages

This commit is contained in:
Ardeman
2025-03-09 09:44:41 +08:00
parent 634c809489
commit 5b94c6df91
3 changed files with 4 additions and 20 deletions
+1 -2
View File
@@ -15,10 +15,9 @@ export const ContentsPage = () => {
const loaderData = useRouteLoaderData<typeof loader>(
'routes/_admin.lg-admin._dashboard.contents._index',
)
const { newsData } = loaderData || {}
DataTable.use(DT)
const dataTable = newsData?.sort(
const dataTable = loaderData?.newsData?.sort(
(a, b) => new Date(b.live_at).getTime() - new Date(a.live_at).getTime(),
)
const dataColumns = [