update remove item from cart, landing page fetch, image normalization

This commit is contained in:
Greg Hoskin
2021-04-04 18:07:14 -06:00
parent d0a04a8fe9
commit abd86329d5
3 changed files with 32 additions and 14 deletions

View File

@@ -46,11 +46,25 @@ const normalizeProductOption = ({
}
}
const normalizeProductImages = (images) =>
images?.map(({ file, id }) => ({
url: file.url,
id,
type SwellImage = {
file: {
url: String
height: Number
width: Number
}
id: string
}
const normalizeProductImages = (images) => {
if (!images) {
return [{ url: '/' }]
}
return images?.map(({ file, ...rest }: SwellImage) => ({
url: file?.url,
height: file.height,
width: file.width,
...rest,
}))
}
const normalizeProductVariants = (variants) => {
return variants?.map(({ id, name, values, price, stock_status }) => ({