refactor: rewrite test connection with RQ

This commit is contained in:
Rıdvan Akca
2024-04-10 12:58:05 +02:00
parent 17fb935ea0
commit 5c9d3ed134
7 changed files with 43 additions and 82 deletions

View File

@@ -0,0 +1,19 @@
import { useMutation } from '@tanstack/react-query';
import api from 'helpers/api';
export default function useTestConnection(
{ connectionId },
{ onSettled } = {},
) {
const query = useMutation({
mutationFn: async () => {
const { data } = await api.post(`/v1/connections/${connectionId}/test`);
return data;
},
onSettled,
});
return query;
}