pagination added to product page
This commit is contained in:
@@ -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/",
|
||||
|
||||
Reference in New Issue
Block a user