feat(web): use REST API endpoint to update step

This commit is contained in:
Ali BARIN
2024-09-18 14:06:54 +00:00
committed by Faruk AYDIN
parent 5f7d1f9219
commit 074e7828f3
3 changed files with 44 additions and 29 deletions

View File

@@ -0,0 +1,28 @@
import { useMutation, useQueryClient } from '@tanstack/react-query';
import api from 'helpers/api';
export default function useUpdateStep() {
const queryClient = useQueryClient();
const query = useMutation({
mutationFn: async ({ id, appKey, key, connectionId, parameters }) => {
const { data } = await api.patch(`/v1/steps/${id}`, {
appKey,
key,
connectionId,
parameters,
});
return data;
},
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: ['flows'],
});
},
});
return query;
}