4
0
forked from crowetic/commerce

Fixed some types

This commit is contained in:
Luis Alvarez 2021-02-14 18:40:48 -05:00
parent 2f903cc66c
commit d9243880a3

View File

@ -75,6 +75,8 @@ const CartItem = ({
setRemoving(false) setRemoving(false)
} }
} }
// TODO: Add a type for this
const options = (item as any).options
useEffect(() => { useEffect(() => {
// Reset the quantity state if the item quantity changes // Reset the quantity state if the item quantity changes
@ -95,8 +97,8 @@ const CartItem = ({
className={s.productImage} className={s.productImage}
width={150} width={150}
height={150} height={150}
src={item.variant.image.url} src={item.variant.image!.url}
alt={item.variant.image.altText} alt={item.variant.image!.altText}
unoptimized unoptimized
/> />
</div> </div>
@ -109,15 +111,15 @@ const CartItem = ({
{item.name} {item.name}
</span> </span>
</Link> </Link>
{item.options && item.options.length > 0 ? ( {options && options.length > 0 ? (
<div className=""> <div className="">
{item.options.map((option: ItemOption, i: number) => ( {options.map((option: ItemOption, i: number) => (
<span <span
key={`${item.id}-${option.name}`} key={`${item.id}-${option.name}`}
className="text-sm font-semibold text-accents-7" className="text-sm font-semibold text-accents-7"
> >
{option.value} {option.value}
{i === item.options.length - 1 ? '' : ', '} {i === options.length - 1 ? '' : ', '}
</span> </span>
))} ))}
</div> </div>