feat: Test the database connection of the ExeSQL operator #1739 (#2036)

### What problem does this PR solve?

feat: Test the database connection of the ExeSQL operator #1739
### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-08-21 15:33:44 +08:00
committed by GitHub
parent 85247e6837
commit 6c26872799
5 changed files with 42 additions and 2 deletions

View File

@ -191,3 +191,24 @@ export const useResetFlow = () => {
return { data, loading, resetFlow: mutateAsync };
};
export const useTestDbConnect = () => {
const {
data,
isPending: loading,
mutateAsync,
} = useMutation({
mutationKey: ['testDbConnect'],
mutationFn: async (params: any) => {
const ret = await flowService.testDbConnect(params);
if (ret?.retcode === 0) {
message.success(ret?.data?.data);
} else {
message.error(ret?.data?.data);
}
return ret;
},
});
return { data, loading, testDbConnect: mutateAsync };
};