refactor: simplify loaderData usage in dashboard categories and contents pages
This commit is contained in:
@@ -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 = [
|
||||
|
||||
Reference in New Issue
Block a user