Async request api codemod
This commit is contained in:
parent
c0a53993ee
commit
65fc690787
@ -10,9 +10,9 @@ function shuffleArray<T>(array: T[]) {
|
||||
}
|
||||
|
||||
interface ProductPageProps {
|
||||
params: {
|
||||
params: Promise<{
|
||||
handle: string;
|
||||
};
|
||||
}>;
|
||||
}
|
||||
|
||||
async function fetchProduct(handle: string, region: HttpTypes.StoreRegion | undefined) {
|
||||
@ -91,7 +91,8 @@ async function fetchProducts(region: HttpTypes.StoreRegion | undefined, count: n
|
||||
}
|
||||
}
|
||||
|
||||
export default async function ProductPage({ params }: ProductPageProps) {
|
||||
export default async function ProductPage(props: ProductPageProps) {
|
||||
const params = await props.params;
|
||||
// const { region } = useRegion();
|
||||
const { handle } = params; // Extract the handle from the params
|
||||
const product: HttpTypes.StoreProduct = await fetchProduct(handle, undefined);
|
||||
@ -99,6 +100,6 @@ export default async function ProductPage({ params }: ProductPageProps) {
|
||||
|
||||
return (
|
||||
// Render the client component and pass necessary props
|
||||
<ProductDetails product={product} relatedProducts={products} />
|
||||
(<ProductDetails product={product} relatedProducts={products} />)
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user