Skip to content

Commit

Permalink
fix: CreatedEvents를 react-query의 select를 사용하여 정렬하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Todari committed Dec 16, 2024
1 parent 79a497a commit f366d8c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/src/hooks/queries/event/useRequestGetCreatedEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ const useRequestGetCreatedEvents = () => {
const {data, ...rest} = useQuery({
queryKey: [QUERY_KEYS.createdEvents],
queryFn: () => requestGetCreatedEvents(),
select: data => ({
...data,
events: data.events.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()),
}),
});

return {
events: data?.events.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()),
events: data?.events,
...rest,
};
};
Expand Down

0 comments on commit f366d8c

Please sign in to comment.