mirror of
https://github.com/vercel/commerce.git
synced 2025-06-20 06:01:21 +00:00
Update [slug].tsx
This commit is contained in:
parent
17ee45307e
commit
34783ae3ee
@ -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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user