refactor: rewrite useFlows as useConnectionFlows and useAppFlows with RQ

This commit is contained in:
Rıdvan Akca
2024-03-19 18:53:20 +03:00
parent ec87c7f21c
commit 316bda8c3f
8 changed files with 64 additions and 113 deletions

View File

@@ -0,0 +1,25 @@
import { useQuery } from '@tanstack/react-query';
import api from 'helpers/api';
export default function useConnectionFlows(
{ connectionId, page },
{ enabled },
) {
const query = useQuery({
queryKey: ['connectionFlows', connectionId, page],
queryFn: async ({ signal }) => {
const { data } = await api.get(`/v1/connections/${connectionId}/flows`, {
params: {
page,
},
signal,
});
return data;
},
enabled,
});
return query;
}