refactor: rewrite get execution steps using useExecutionSteps with RQ
This commit is contained in:
24
packages/web/src/hooks/useExecutionSteps.js
Normal file
24
packages/web/src/hooks/useExecutionSteps.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import api from 'helpers/api';
|
||||
|
||||
export default function useExecutionSteps(executionId, page) {
|
||||
const query = useQuery({
|
||||
queryKey: ['executionSteps', executionId, page],
|
||||
queryFn: async ({ payload, signal }) => {
|
||||
const { data } = await api.get(
|
||||
`/v1/executions/${executionId}/execution-steps`,
|
||||
{
|
||||
params: {
|
||||
page: page,
|
||||
},
|
||||
signal,
|
||||
},
|
||||
);
|
||||
|
||||
return data;
|
||||
},
|
||||
});
|
||||
|
||||
return query;
|
||||
}
|
Reference in New Issue
Block a user