Files
ignum/request/links.ts
nabijonovdavronbek619@gmail.com f396125acf add additional filter to product page
2026-03-07 21:16:56 +05:00

70 lines
1.9 KiB
TypeScript

interface ProductTypes {
id: number;
currentPage: number;
}
export const endPoints = {
category: {
all: "category/",
},
subCategory: {
byId: (id: number) => `subCategory/?category=${id}`,
},
services: {
all: "firesafety/?page_size=500",
detail: (id: number) => `firesafety/${id}`,
},
product: {
byCategory: ({ id, currentPage }: ProductTypes) => {
let link = "product/?page_size=12";
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;
},
byCatalogSection: ({ id, currentPage }: ProductTypes) => {
let link = "product";
if (id) link += `?catalog_section=${id}`;
if (currentPage) link += `&page=${currentPage}`;
return link;
},
detail: (id: number) => `product/${id}/`,
},
faq: "faq/",
gallery: "gallery/?page_size=500",
contact: "contact/",
statistics: "statistics/",
banner: "banner/?page_size=500",
navbar: "navigationitem/?page_size=500",
sertificate: "document/?type=certificate",
normative: "document/?type=normative",
guides: "guide/",
filter: {
size: "size/",
sizePageItems: "size/?page_size=500",
sizeCategoryId: (id: number) => `size/?category=${id}&page_size=500`,
catalog: "catalog/",
catalogPageItems: "catalog/?page_size=500",
catalogCategoryId: (id: number) => `catalog/?category=${id}&page_size=500`,
child: ({ id }: { id?: number }) => {
const link = "catalogsection/?page_size=500";
if (id) return `${link}&parent=${id}`;
return link;
},
catalogSection: "catalogsection/?page_size=500",
},
post: {
sendNumber: "callBack/",
productContact: "customer/",
contact: "question/",
},
};