Skip to content

Commit

Permalink
Default some product values
Browse files Browse the repository at this point in the history
  • Loading branch information
craigtweedy committed Feb 10, 2021
1 parent 48e60d7 commit a33b733
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/product/listing/ProductListing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface ProductListingProps {
}

const ProductListing: React.FC<ProductListingProps> = ({ product }) => {
const { variants, assets, meta, related_products } = product;
const { variants, assets = [], meta = {}, related_products = [] } = product;
const images = assets.filter(({ is_image }) => is_image);
return (
<IonGrid className="product-listing">
Expand Down
3 changes: 1 addition & 2 deletions src/pages/product/Product.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import "./Product.css";
import Commerce from "@chec/commerce.js";
import { useEffect, useState } from "react";
import { RouteComponentProps } from "react-router";
import ProductCard from "../../components/product/listing/ProductListing";
import ProductListing from "../../components/product/listing/ProductListing";

interface ProductDetailPageProps
Expand All @@ -33,7 +32,7 @@ const ProductDetail: React.FC<ProductDetailPageProps> = ({
.retrieve(match.params.id)
.then((product) => setProduct(product))
.catch((e) => console.error(e));
}, []);
}, [match.params.id]);

return (
<IonPage>
Expand Down

0 comments on commit a33b733

Please sign in to comment.