refactor: move abort controller into useLazyApps hook

This commit is contained in:
Rıdvan Akca
2024-03-11 16:16:12 +03:00
parent 2ee5af8bfb
commit 5835def5d0
7 changed files with 47 additions and 38 deletions

View File

@@ -0,0 +1,22 @@
import { useQuery } from '@tanstack/react-query';
import api from 'helpers/api';
export default function useActionSubsteps(appKey, actionKey) {
const query = useQuery({
queryKey: ['actionSubsteps', appKey, actionKey],
queryFn: async ({ payload, signal }) => {
const { data } = await api.get(
`/v1/apps/${appKey}/actions/${actionKey}/substeps`,
{
signal,
},
);
return data;
},
enabled: !!appKey,
});
return query;
}