From c5f2f6f55a3c01eca8303940bd2108f48d119bb6 Mon Sep 17 00:00:00 2001 From: pakxe Date: Wed, 21 Aug 2024 18:15:01 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20onSuccessCallBack=20=EC=9D=84=20?= =?UTF-8?q?=EC=97=86=EC=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/hooks/queries/useRequestPutBillAction.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/client/src/hooks/queries/useRequestPutBillAction.ts b/client/src/hooks/queries/useRequestPutBillAction.ts index f2bfe8781..a58da8ea4 100644 --- a/client/src/hooks/queries/useRequestPutBillAction.ts +++ b/client/src/hooks/queries/useRequestPutBillAction.ts @@ -10,7 +10,6 @@ interface PutBillActionMutationProps { actionId: number; title: string; price: number; - onSuccessCallback?: () => void; // 콜백 함수 타입을 정의 } const useRequestPutBillAction = () => { @@ -18,18 +17,11 @@ const useRequestPutBillAction = () => { const queryClient = useQueryClient(); return useMutation({ - mutationFn: async ({actionId, title, price}: PutBillActionMutationProps) => { - const response = await requestPutBillAction({eventId, actionId, title, price}); - return response; // response를 반환하여 onSuccess에서 접근할 수 있게 함 - }, - onSuccess: (data, variables) => { + mutationFn: ({actionId, title, price}: PutBillActionMutationProps) => + requestPutBillAction({eventId, actionId, title, price}), + onSuccess: () => { queryClient.invalidateQueries({queryKey: [QUERY_KEYS.stepList]}); queryClient.invalidateQueries({queryKey: [QUERY_KEYS.memberReport]}); - - // 콜백 함수가 전달되었다면 실행 - if (variables.onSuccessCallback) { - variables.onSuccessCallback(); - } }, }); };