feat: run flow (#1076)

### What problem does this PR solve?

feat: run flow #918 

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-06-06 15:00:37 +08:00
committed by GitHub
parent d9dc183a0e
commit db35e9df4f
9 changed files with 88 additions and 20 deletions

View File

@ -90,3 +90,22 @@ export const useDeleteFlow = () => {
return { data, loading, deleteFlow: mutateAsync };
};
export const useRunFlow = () => {
const {
data,
isPending: loading,
mutateAsync,
} = useMutation({
mutationKey: ['runFlow'],
mutationFn: async (params: { id: string; dsl: DSL }) => {
const { data } = await flowService.runCanvas(params);
if (data.retcode === 0) {
message.success(i18n.t(`message.modified`));
}
return data?.data ?? {};
},
});
return { data, loading, runFlow: mutateAsync };
};