Skip to content

Commit

Permalink
fix: 참여신청한 행사 취소요청 혹은 취소 시 제출된 폼 QUERYKEY무효화 (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
colorkite10 authored Dec 2, 2023
1 parent 25399ac commit 3dd2001
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/hooks/query/event/useCancelEventMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import useToast from '@/hooks/useToast';
import { useMutation, useQueryClient } from '@tanstack/react-query';

import { QUERY_KEY } from './useAppliedEventQuery';
import { QUERY_KEY as SUBMITTED_FORM_QUERY_KEY } from './useGetSubmittedFormsQuery';

const useCancelEventMutation = () => {
const { createToast } = useToast();
Expand All @@ -25,7 +26,10 @@ const useCancelEventMutation = () => {
throw new Error('취소 요청 후 이벤트 상태가 CANCEL_REQUESTED 또는 CANCELED가 아닙니다');
}

queryClient.invalidateQueries([QUERY_KEY.APPLIED_EVENT]);
Promise.all([
queryClient.invalidateQueries([QUERY_KEY.APPLIED_EVENT]),
queryClient.invalidateQueries([SUBMITTED_FORM_QUERY_KEY.SUBMITTED_FORMS]),
]);
},
onError: () => {
createToast({ message: ERROR_MESSAGE.EVENT.CANCEL, toastType: 'error' });
Expand Down

0 comments on commit 3dd2001

Please sign in to comment.