pagination added to product page

This commit is contained in:
nabijonovdavronbek619@gmail.com
2026-02-19 17:11:08 +05:00
parent ed4363e523
commit d8faba0fb5
6 changed files with 336 additions and 70 deletions

View File

@@ -1,3 +1,8 @@
interface ProductTypes {
id: number;
currentPage: number;
}
export const endPoints = {
category: {
all: "category/",
@@ -10,9 +15,20 @@ export const endPoints = {
detail: (id: number) => `firesafety/${id}`,
},
product: {
byCategory: (categoryId: number) => `product/?category=${categoryId}`,
bySubCategory: (subCategoryId: number) =>
`product/?subCategory=${subCategoryId}`,
byCategory: ({ id, currentPage }: ProductTypes) => {
let link = "product/";
if (id) link += `?category=${id}`;
if (currentPage) link += `&page=${currentPage}`;
return link;
},
bySubCategory: ({ id, currentPage }: ProductTypes) => {
let link = "product/";
if (id) link += `?subCategory=${id}`;
if (currentPage) link += `&page=${currentPage}`;
return link;
},
detail: (id: number) => `product/${id}/`,
},
faq: "faq/",