diff --git a/app/frontend/src/queries/hooks/index.ts b/app/frontend/src/queries/hooks/index.ts new file mode 100644 index 000000000..6982a6621 --- /dev/null +++ b/app/frontend/src/queries/hooks/index.ts @@ -0,0 +1 @@ +export * from './mogaco'; diff --git a/app/frontend/src/queries/hooks/mogaco.ts b/app/frontend/src/queries/hooks/mogaco.ts new file mode 100644 index 000000000..2957aa4b1 --- /dev/null +++ b/app/frontend/src/queries/hooks/mogaco.ts @@ -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, + }); + }, + }); +};