feat(MED-131): display analyses options and add to cart
This commit is contained in:
@@ -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])
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user