feat: add useTriggerSubsteps and useActionSubsteps with RQ

This commit is contained in:
Rıdvan Akca
2024-03-05 15:08:10 +03:00
parent c4b2ea125c
commit 5fe3546d2a
3 changed files with 64 additions and 1 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;
}

View File

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