We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b8efac8 commit faacafbCopy full SHA for faacafb
src/app/(main)/products/[handle]/page.tsx
@@ -8,12 +8,13 @@ type Props = {
8
}
9
10
export async function generateMetadata({ params }: Props): Promise<Metadata> {
11
- const { products } = await getProductByHandle(params.handle).catch((err) => {
12
- console.error(err)
13
- notFound()
14
- })
+ const data = await getProductByHandle(params.handle)
15
16
- const product = products[0]
+ const product = data.products[0]
+
+ if (!product) {
+ notFound()
17
+ }
18
19
return {
20
title: `${product.title} | Acme Store`,
@@ -32,7 +33,5 @@ export default async function CollectionPage({ params }: Props) {
32
33
notFound()
34
})
35
- console.log(products)
36
-
37
return <ProductTemplate product={products[0]} />
38
0 commit comments