refactor: rewrite useFlow and useStepConnection with RQ
This commit is contained in:
19
packages/web/src/hooks/useFlow.js
Normal file
19
packages/web/src/hooks/useFlow.js
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user