feat: call the reset api before opening the run drawer each time #918 (#1370)

### What problem does this PR solve?

feat:  call the reset api before opening the run drawer each time #918
### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-07-04 15:10:45 +08:00
committed by GitHub
parent 4122695a1a
commit 1d3e4844a5
5 changed files with 51 additions and 15 deletions

View File

@ -164,3 +164,20 @@ export const useRunFlow = () => {
return { data, loading, runFlow: mutateAsync };
};
export const useResetFlow = () => {
const { id } = useParams();
const {
data,
isPending: loading,
mutateAsync,
} = useMutation({
mutationKey: ['resetFlow'],
mutationFn: async () => {
const { data } = await flowService.resetCanvas({ id });
return data;
},
});
return { data, loading, resetFlow: mutateAsync };
};