forked from crowetic/commerce
Don't fail when collections are not found (#996)
* Don't fail when collections are not found * fix another error
This commit is contained in:
parent
af21b29b73
commit
9ea5671579
@ -17,7 +17,7 @@ export default function ProductGridItems({ products }: { products: Product[] })
|
||||
amount: product.priceRange.maxVariantPrice.amount,
|
||||
currencyCode: product.priceRange.maxVariantPrice.currencyCode
|
||||
}}
|
||||
src={product.featuredImage.url}
|
||||
src={product.featuredImage?.url}
|
||||
width={600}
|
||||
height={600}
|
||||
/>
|
||||
|
@ -82,7 +82,7 @@ export function Gallery({
|
||||
onClick={() => setCurrentImage(index)}
|
||||
>
|
||||
<GridTileImage
|
||||
alt={image.altText}
|
||||
alt={image?.altText}
|
||||
src={image.src}
|
||||
width={600}
|
||||
height={600}
|
||||
|
@ -265,6 +265,11 @@ export async function getCollectionProducts(handle: string): Promise<Product[]>
|
||||
}
|
||||
});
|
||||
|
||||
if (!res.body.data.collection) {
|
||||
console.log('No collection found for handle', handle);
|
||||
return [];
|
||||
}
|
||||
|
||||
return reshapeProducts(removeEdgesAndNodes(res.body.data.collection.products));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user