feat: use REST API endpoint to create flow

This commit is contained in:
Ali BARIN
2024-09-18 14:51:23 +00:00
parent 1790ef0ee6
commit 2e5dfdbb0d
6 changed files with 39 additions and 47 deletions

View File

@@ -0,0 +1,23 @@
import { useMutation, useQueryClient } from '@tanstack/react-query';
import api from 'helpers/api';
export default function useCreateFlow() {
const queryClient = useQueryClient();
const query = useMutation({
mutationFn: async () => {
const { data } = await api.post('/v1/flows');
return data;
},
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: ['flows'],
});
},
});
return query;
}