GetCategory
Implements GetCategory
Unified Method.
Source
import { defineApi } from "@vsf-enterprise/unified-api-magento";
import { getNormalizers } from "@vsf-enterprise/unified-api-magento/udl";
import { getRawCategory } from "@vsf-enterprise/unified-api-magento";
export const getCategory = defineApi.getCategory(async (context, args) => {
const { normalizeCategory } = getNormalizers(context);
const { ancestors, category } = await getRawCategory(context, args);
return {
ancestors: ancestors.map((category) => normalizeCategory(category)),
category: normalizeCategory(category),
};
});