refactor: rewrite get execution using useExecution with RQ

This commit is contained in:
Rıdvan Akca
2024-03-11 14:40:11 +03:00
parent 8d9c43af6a
commit 46491269e3
8 changed files with 28 additions and 52 deletions

View File

@@ -0,0 +1,18 @@
import { useQuery } from '@tanstack/react-query';
import api from 'helpers/api';
export default function useExecution({ executionId }) {
const query = useQuery({
queryKey: ['execution', executionId],
queryFn: async ({ signal }) => {
const { data } = await api.get(`/v1/executions/${executionId}`, {
signal,
});
return data;
},
});
return query;
}