first commit
This commit is contained in:
commit
c9fb67e751
423 files changed
+53287
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import { useMutation, useQueryClient } from 'react-query';
|
||||
import api from '../services/api';
|
||||
import { Comentario } from '../types/entities';
|
||||
|
||||
export const useComentarios = (tarefaId: string) => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const addComentario = useMutation(
|
||||
async (texto: string) => {
|
||||
const response = await api.post(`/tarefas/${tarefaId}/comentarios`, { texto });
|
||||
return response.data;
|
||||
},
|
||||
{
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(['tarefas', tarefaId]);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return {
|
||||
addComentario
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user