feat(MED-131): display analyses options and add to cart

This commit is contained in:
2025-08-04 11:51:49 +03:00
parent 8c4df731aa
commit b665678dbb
5 changed files with 142 additions and 6 deletions

View File

@@ -27,8 +27,22 @@ export const listCategories = async (query?: Record<string, any>) => {
}
export const getCategoryByHandle = async (categoryHandle: string[]) => {
const handle = `${categoryHandle.join("/")}`
const { product_categories } = await getProductCategories({
handle: `${categoryHandle.join("/")}`,
limit: 1,
});
return product_categories[0];
}
export const getProductCategories = async ({
handle,
limit,
fields = "*category_children, *products",
}: {
handle?: string;
limit?: number;
fields?: string;
} = {}) => {
const next = {
...(await getCacheOptions("categories")),
}
@@ -38,12 +52,12 @@ export const getCategoryByHandle = async (categoryHandle: string[]) => {
`/store/product-categories`,
{
query: {
fields: "*category_children, *products",
fields,
handle,
limit,
},
next,
cache: "force-cache",
//cache: "force-cache",
}
)
.then(({ product_categories }) => product_categories[0])
);
}

View File

@@ -159,7 +159,7 @@ export const listProductTypes = async (): Promise<{ productTypes: HttpTypes.Stor
"/store/product-types",
{
next,
cache: "force-cache",
//cache: "force-cache",
query: {
fields: "id,value,metadata",
},