refactor: rewrite get executions using useExecutions with RQ

This commit is contained in:
Rıdvan Akca
2024-03-12 14:33:09 +03:00
parent f07b6d105a
commit 3bc0c23e5a
7 changed files with 37 additions and 627 deletions

View File

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