24 lines
919 B
TypeScript
24 lines
919 B
TypeScript
'use client';
|
|
import { useState } from 'react';
|
|
import { BuildDataTableAdd } from './table/data-table';
|
|
import { BuildsForm } from './form';
|
|
import { useGraphQlBuildsList } from '../queries';
|
|
|
|
const PageAddBuilds = () => {
|
|
const [page, setPage] = useState(1);
|
|
const [limit, setLimit] = useState(10);
|
|
const [sort, setSort] = useState({ createdAt: 'desc' });
|
|
const [filters, setFilters] = useState({});
|
|
|
|
const { data, isFetching, isLoading, error, refetch } = useGraphQlBuildsList({ limit, skip: (page - 1) * limit, sort, filters });
|
|
|
|
return (
|
|
<>
|
|
<BuildDataTableAdd data={data?.data || []} totalCount={data?.totalCount || 0} currentPage={page} pageSize={limit} onPageChange={setPage} onPageSizeChange={setLimit} refetchTable={refetch} tableIsLoading={isFetching || isLoading} />
|
|
<BuildsForm refetchTable={refetch} />
|
|
</>
|
|
)
|
|
}
|
|
|
|
export { PageAddBuilds };
|