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`)
}
const relatedProductsPromise = commerce.getRelatedProducts({
variables: { productId: product.id, first: 4 },
config,
preview,
})
// Temporary conditional query
const { products: relatedProducts } =
process.env.COMMERCE_PROVIDER === 'shopify'
? await relatedProductsPromise
? await commerce.getRelatedProducts({
variables: { productId: product.id, first: 4 },
config,
preview,
})
: await allProductsPromise
return {