Added offset fix

This commit is contained in:
Daniel Cojocea committed 2024-07-09 01:40:45 -04:00
1 parent 30f7ecff82
commit 44465efd25
1 file changed
+4 -4
+4 -4
View File
@@ -94,7 +94,7 @@ const Status = ({ params }) => {
* @returns {React.Component} Returns a table with the monitor data. * @returns {React.Component} Returns a table with the monitor data.
*/ */
const MonitorTable = ({ monitors = [] }) => { const MonitorTable = ({ monitors = [] }) => {
const [page, setPage] = useState(1); const [page, setPage] = useState(0);
const rowsPerPage = 5; const rowsPerPage = 5;
const handleChangePage = (event, newPage) => { const handleChangePage = (event, newPage) => {
@@ -102,7 +102,7 @@ const MonitorTable = ({ monitors = [] }) => {
}; };
const mappedRows = monitors const mappedRows = monitors
.slice((page - 1) * rowsPerPage, page * rowsPerPage) .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map((monitor) => { .map((monitor) => {
const params = { const params = {
url: monitor.url, url: monitor.url,
@@ -161,8 +161,8 @@ const MonitorTable = ({ monitors = [] }) => {
</TableContainer> </TableContainer>
<Pagination <Pagination
count={Math.ceil(monitors?.length / rowsPerPage)} count={Math.ceil(monitors?.length / rowsPerPage)}
page={page} page={page + 1}
onChange={handleChangePage} onChange={(event, value) => handleChangePage(event, value - 1)}
shape="rounded" shape="rounded"
renderItem={(item) => ( renderItem={(item) => (
<PaginationItem <PaginationItem