refactor(Flows): utilize useQuery over useMutation

This commit is contained in:
Ali BARIN
2025-01-20 15:38:21 +00:00
parent 08c1abe193
commit b237b2a2bc
7 changed files with 26 additions and 75 deletions

View File

@@ -0,0 +1,18 @@
import api from 'helpers/api';
import { useQuery } from '@tanstack/react-query';
export default function useFlows({ flowName, page }) {
const query = useQuery({
queryKey: ['flows', flowName, { page }],
queryFn: async ({ signal }) => {
const { data } = await api.get('/v1/flows', {
params: { name: flowName, page },
signal,
});
return data;
},
});
return query;
}