Skip to content

Commit

Permalink
feat: 회비 추가 후 dues 쿼리 무효화
Browse files Browse the repository at this point in the history
  • Loading branch information
dooohun committed Feb 2, 2025
1 parent 61e20f8 commit a25a546
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/query/dues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@ export const useGetAllDues = ({ year, track }: DuesOptions) => {

export const usePostDues = () => {
const openSnackBar = useSnackBar();
const queryClient = new QueryClient();

const postDuesMutation = useMutation({
mutationKey: ['postDues'],
mutationFn: (data: NewDuesData) => postDues(data),
onError: (error) => openSnackBar({ type: 'error', message: error.message }),
onSuccess: () => openSnackBar({ type: 'success', message: '회비 내역이 수정되었습니다.' }),
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: ['dues'],
});
openSnackBar({ type: 'success', message: '회비 내역이 수정되었습니다.' });
},
});
return postDuesMutation;
};
Expand Down

0 comments on commit a25a546

Please sign in to comment.