Skip to content

Commit

Permalink
✨ 모각코 delete mutation hook 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
ttaerrim committed Nov 23, 2023
1 parent 702d081 commit 564d40d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/frontend/src/queries/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './mogaco';
18 changes: 18 additions & 0 deletions app/frontend/src/queries/hooks/mogaco.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { useMutation, useQueryClient } from '@tanstack/react-query';

import { mogaco } from '@/services';

import { queryKeys } from '..';

export const useDeleteMogacoQuery = () => {
const queryClient = useQueryClient();

return useMutation({
mutationFn: (postId: string) => mogaco.delete(postId),
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: queryKeys.mogaco.list().queryKey,
});
},
});
};

0 comments on commit 564d40d

Please sign in to comment.