From f366d8c0e638c12882a63e50a5eaac6b3b60e146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=90=E1=85=A2=E1=84=92=E1=85=AE?= =?UTF-8?q?=E1=86=AB?= Date: Mon, 16 Dec 2024 19:00:22 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20CreatedEvents=EB=A5=BC=20react-query?= =?UTF-8?q?=EC=9D=98=20select=EB=A5=BC=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=97=AC=20=EC=A0=95=EB=A0=AC=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/hooks/queries/event/useRequestGetCreatedEvents.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/hooks/queries/event/useRequestGetCreatedEvents.ts b/client/src/hooks/queries/event/useRequestGetCreatedEvents.ts index fe1cc227..f32a24ed 100644 --- a/client/src/hooks/queries/event/useRequestGetCreatedEvents.ts +++ b/client/src/hooks/queries/event/useRequestGetCreatedEvents.ts @@ -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, }; };