Fix some broken types

Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
Chloe 2022-04-26 16:35:01 +07:00
parent 999dae22d5
commit f5f8d7bd8b
2 changed files with 5 additions and 9 deletions

View File

@ -1,10 +1,4 @@
{
"provider": "opencommerce",
"features": {
"wishlist": false,
"cart": false,
"search": false,
"customerAuth": false,
"customCheckout": false
}
"features": {}
}

View File

@ -48,7 +48,7 @@ export function normalizeProduct(
images: media?.length
? normalizeProductImages(<ImageInfo[]>media, title ?? '')
: [],
vendor: product.vendor ?? undefined,
...(product.vendor ? { vendor: product.vendor } : {}),
price: {
value: pricing[0]?.minPrice ?? 0,
currencyCode: pricing[0]?.currency.code,
@ -175,7 +175,9 @@ const normalizeProductOption = (variant: CatalogProductVariant) => {
__typename: 'MultipleChoiceOption',
id: variant._id,
displayName: variant.attributeLabel,
values: variant.optionTitle ? [{ label: variant.optionTitle }] : [],
values: variant.optionTitle
? [{ label: variant.optionTitle }]
: [{ label: '' }],
}
option.values = option.values.map((value) =>
colorizeProductOptionValue(value, option.displayName)