Update [slug].tsx

This commit is contained in:
cond0r 2021-06-15 14:02:07 +03:00
parent 17ee45307e
commit 34783ae3ee

View File

@ -37,16 +37,14 @@ export async function getStaticProps({
throw new Error(`Product with slug '${params!.slug}' not found`) throw new Error(`Product with slug '${params!.slug}' not found`)
} }
const relatedProductsPromise = commerce.getRelatedProducts({ // Temporary conditional query
const { products: relatedProducts } =
process.env.COMMERCE_PROVIDER === 'shopify'
? await commerce.getRelatedProducts({
variables: { productId: product.id, first: 4 }, variables: { productId: product.id, first: 4 },
config, config,
preview, preview,
}) })
// Temporary conditional query
const { products: relatedProducts } =
process.env.COMMERCE_PROVIDER === 'shopify'
? await relatedProductsPromise
: await allProductsPromise : await allProductsPromise
return { return {