fix
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user