26 lines
944 B
TypeScript
26 lines
944 B
TypeScript
'use client';
|
|
import { useState } from 'react';
|
|
import { BuildAreasDataTableAdd } from './table/data-table';
|
|
import { useGraphQlBuildAreasList } from '@/pages/build-areas/queries';
|
|
import { BuildAreasForm } from './form';
|
|
|
|
const PageAddBuildAreas = () => {
|
|
const [page, setPage] = useState(1);
|
|
const [limit, setLimit] = useState(10);
|
|
const [sort, setSort] = useState({ createdAt: 'desc' });
|
|
const [filters, setFilters] = useState({});
|
|
|
|
const { data, isLoading, error, refetch } = useGraphQlBuildAreasList({ limit, skip: (page - 1) * limit, sort, filters });
|
|
|
|
return (
|
|
<>
|
|
<BuildAreasDataTableAdd
|
|
data={data?.data || []} totalCount={data?.totalCount || 0} currentPage={page} pageSize={limit} onPageChange={setPage} onPageSizeChange={setLimit} refetchTable={refetch}
|
|
/>
|
|
<BuildAreasForm refetchTable={refetch} />
|
|
</>
|
|
)
|
|
}
|
|
|
|
export { PageAddBuildAreas };
|