This commit is contained in:
Samandar Turgunboyev
2026-02-25 12:59:57 +05:00
parent 4fd458075c
commit ed5ee752c9
2 changed files with 4 additions and 4 deletions

View File

@@ -100,7 +100,7 @@ const AllProducts = () => {
<div className="w-full mt-5 flex justify-end">
<GlobalPagination
page={page}
total={product.total ?? 0}
total={product.total}
pageSize={PAGE_SIZE}
onChange={handlePageChange}
/>

View File

@@ -6,7 +6,7 @@ import { Button } from './button';
type GlobalPaginationProps = {
page: number;
total: number;
pageSize?: number;
pageSize: number;
onChange: (page: number) => void;
};
@@ -23,7 +23,7 @@ const getPages = (current: number, total: number) => {
pages.push('dots');
}
const start = Math.min(2, current - 1);
const start = Math.max(2, current - 1);
const end = Math.min(total - 1, current + 1);
for (let i = start; i <= end; i++) {
@@ -42,7 +42,7 @@ const getPages = (current: number, total: number) => {
export const GlobalPagination = ({
page,
total,
pageSize = 36,
pageSize,
onChange,
}: GlobalPaginationProps) => {
const totalPages = Math.ceil(total / pageSize);