refactor: rewrite useFlow and useStepConnection with RQ

This commit is contained in:
Rıdvan Akca
2024-03-22 17:44:05 +03:00
parent c8147370de
commit fc04a357c8
16 changed files with 174 additions and 365 deletions

View File

@@ -0,0 +1,19 @@
import { useQuery } from '@tanstack/react-query';
import api from 'helpers/api';
export default function useFlow(flowId) {
const query = useQuery({
queryKey: ['flow', flowId],
queryFn: async ({ signal }) => {
const { data } = await api.get(`/v1/flows/${flowId}`, {
signal,
});
return data;
},
enabled: !!flowId,
});
return query;
}