From 0f36683090a530628177af87217b6817816593ba Mon Sep 17 00:00:00 2001 From: qkrdmstlr3 Date: Sat, 31 Aug 2024 04:51:17 +0900 Subject: [PATCH] =?UTF-8?q?feat(onboarding):=20=EC=BA=90=EC=8B=9C=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(sidebar)/(my-info)/apis/usePutOnboardStatus.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/(sidebar)/(my-info)/apis/usePutOnboardStatus.ts b/src/app/(sidebar)/(my-info)/apis/usePutOnboardStatus.ts index 4e780fe..5654508 100644 --- a/src/app/(sidebar)/(my-info)/apis/usePutOnboardStatus.ts +++ b/src/app/(sidebar)/(my-info)/apis/usePutOnboardStatus.ts @@ -1,16 +1,22 @@ import { http } from '@/apis/http'; -import { useMutation } from '@tanstack/react-query'; +import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { GET_ONBOARD_STATUS } from '@/app/(sidebar)/(my-info)/apis/useGetOnboadStatus'; const putOnboardStatus = () => { return http.put({ url: `/users/onboard-status`, data: { isOnboardComplete: true } }); }; export const usePutOnboardStatus = () => { + const queryClient = useQueryClient(); + const mutate = useMutation({ mutationFn: async () => { const res = await putOnboardStatus(); return res.data; }, + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: [GET_ONBOARD_STATUS] }); + }, }); return mutate;