docs: update next.js storefront snippets (#10840)

This commit is contained in:
Shahed Nasser
2025-01-06 16:35:56 +02:00
committed by GitHub
parent 3253e19b36
commit 9490c265b2
4 changed files with 17 additions and 13 deletions
@@ -1204,14 +1204,19 @@ import { client } from "../../../../../sanity/lib/client"
// ...
export default async function ProductPage({ params }: Props) {
export default async function ProductPage(props: Props) {
const params = await props.params
const region = await getRegion(params.countryCode)
if (!region) {
notFound()
}
const pricedProduct = await getProductByHandle(params.handle, region.id)
const pricedProduct = await listProducts({
countryCode: params.countryCode,
queryParams: { handle: params.handle },
}).then(({ response }) => response.products[0])
if (!pricedProduct) {
notFound()
}
@@ -1224,7 +1229,6 @@ export default async function ProductPage({ params }: Props) {
product={pricedProduct}
region={region}
countryCode={params.countryCode}
sanity={sanity}
/>
)
}