mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
Fix: color option
This commit is contained in:
@@ -22,14 +22,17 @@ const normalizeProductOption = ({
|
||||
name: displayName,
|
||||
values,
|
||||
...rest
|
||||
}: ProductOption) => ({
|
||||
__typename: 'MultipleChoiceOption',
|
||||
displayName,
|
||||
values: values.map((value) => ({
|
||||
label: value,
|
||||
})),
|
||||
...rest,
|
||||
})
|
||||
}: ProductOption) => {
|
||||
return {
|
||||
__typename: 'MultipleChoiceOption',
|
||||
displayName,
|
||||
values: values.map((value) => ({
|
||||
label: value,
|
||||
hexColors: displayName === 'Color' ? [value] : null,
|
||||
})),
|
||||
...rest,
|
||||
}
|
||||
}
|
||||
|
||||
const normalizeProductImages = ({ edges }: ImageConnection) =>
|
||||
edges?.map(({ node: { originalSrc: url, ...rest } }) => ({
|
||||
|
@@ -29,6 +29,8 @@ const getProduct = async (options: {
|
||||
|
||||
const product = data?.productByHandle
|
||||
|
||||
console.info(normalizeProduct(product))
|
||||
|
||||
return {
|
||||
product: product ? normalizeProduct(product) : null,
|
||||
}
|
||||
|
Reference in New Issue
Block a user