refactor: rewrite get executions using useExecutions with RQ
This commit is contained in:
22
packages/web/src/hooks/useExecutions.js
Normal file
22
packages/web/src/hooks/useExecutions.js
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user