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,22 @@
import { useQuery } from '@tanstack/react-query';
import api from 'helpers/api';
export default function useAppFlows({ appKey, page }, { enabled }) {
const query = useQuery({
queryKey: ['appFlows', appKey, page],
queryFn: async ({ signal }) => {
const { data } = await api.get(`/v1/apps/${appKey}/flows`, {
params: {
page,
},
signal,
});
return data;
},
enabled,
});
return query;
}