change notification sorting by creation date

This commit is contained in:
Raja Oktafrianto
2025-04-21 09:53:09 +07:00
parent b93dfd1bfd
commit 814bf9f04f
2 changed files with 5 additions and 3 deletions

View File

@ -107,7 +107,7 @@ const ManageNotifContextProvider = ({ children }: { children: React.ReactNode })
const getNotificationList = async (page: number, limit: number, sorting: any, filter: any) => {
try {
sorting = sorting.length == 0 ? [{ id: 'content', desc: false }] : sorting;
sorting = sorting.length === 0 ? [{ id: 'created_at', desc: true }] : sorting;
filter =
filter.length == 0 ? {} : { content: { like: `%${filter[0].value?.toLowerCase()}%` } };
const response = await GetData(`${API_URL_NOTIFICATION}/list`, {
@ -145,7 +145,7 @@ const ManageNotifContextProvider = ({ children }: { children: React.ReactNode })
pagination={{ size: 10 }}
toolbar={<ListToolBar />}
layout={{ card: true }}
sorting={[{ id: 'content', desc: false }]}
sorting={[{ id: 'created_at', desc: true }]}
serverSide={true}
onFetchData={({ pageIndex, pageSize, sorting, columnFilters }) =>
getNotificationList(pageIndex, pageSize, sorting, columnFilters)