refactor(web): remove typescript
This commit is contained in:
@@ -7,27 +7,21 @@ import CircularProgress from '@mui/material/CircularProgress';
|
||||
import Divider from '@mui/material/Divider';
|
||||
import Pagination from '@mui/material/Pagination';
|
||||
import PaginationItem from '@mui/material/PaginationItem';
|
||||
import type { IExecution } from 'types';
|
||||
|
||||
import NoResultFound from 'components/NoResultFound';
|
||||
import ExecutionRow from 'components/ExecutionRow';
|
||||
import Container from 'components/Container';
|
||||
import PageTitle from 'components/PageTitle';
|
||||
import useFormatMessage from 'hooks/useFormatMessage';
|
||||
import { GET_EXECUTIONS } from 'graphql/queries/get-executions';
|
||||
|
||||
const EXECUTION_PER_PAGE = 10;
|
||||
|
||||
const getLimitAndOffset = (page: number) => ({
|
||||
const getLimitAndOffset = (page) => ({
|
||||
limit: EXECUTION_PER_PAGE,
|
||||
offset: (page - 1) * EXECUTION_PER_PAGE,
|
||||
});
|
||||
|
||||
export default function Executions(): React.ReactElement {
|
||||
export default function Executions() {
|
||||
const formatMessage = useFormatMessage();
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const page = parseInt(searchParams.get('page') || '', 10) || 1;
|
||||
|
||||
const { data, refetch, loading } = useQuery(GET_EXECUTIONS, {
|
||||
variables: getLimitAndOffset(page),
|
||||
fetchPolicy: 'cache-and-network',
|
||||
@@ -35,16 +29,11 @@ export default function Executions(): React.ReactElement {
|
||||
});
|
||||
const getExecutions = data?.getExecutions || {};
|
||||
const { pageInfo, edges } = getExecutions;
|
||||
|
||||
React.useEffect(() => {
|
||||
refetch(getLimitAndOffset(page));
|
||||
}, [refetch, page]);
|
||||
|
||||
const executions: IExecution[] = edges?.map(
|
||||
({ node }: { node: IExecution }) => node
|
||||
);
|
||||
const executions = edges?.map(({ node }) => node);
|
||||
const hasExecutions = executions?.length;
|
||||
|
||||
return (
|
||||
<Box sx={{ py: 3 }}>
|
||||
<Container>
|
Reference in New Issue
Block a user