first commit

This commit is contained in:
rodrigo committed 2025-04-10 23:07:21 -03:00
commit c9fb67e751
423 files changed
+53287

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
import { useMutation, useQueryClient } from 'react-query';
import api from '../services/api';
import { SubTarefa } from '../types/entities';
export const useSubtarefas = (tarefaId: string) => {
const queryClient = useQueryClient();
const toggleSubtarefa = useMutation(
async ({ id, concluida }: { id: string; concluida: boolean }) => {
const response = await api.patch(`/tarefas/${tarefaId}/subtarefas/${id}`, { concluida });
return response.data;
},
{
onSuccess: () => {
queryClient.invalidateQueries(['tarefas', tarefaId]);
}
}
);
return {
toggleSubtarefa
};
};