mirror of
https://github.com/vercel/commerce.git
synced 2025-07-26 03:31:23 +00:00
Merge branch 'feature/m3-relevant-product' of https://github.com/KieIO/grocery-vercel-commerce into feature/m1-get-product-detail
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
import commerce from '@lib/api/commerce';
|
||||
import { GetStaticPropsContext } from 'next';
|
||||
import { Layout } from 'src/components/common';
|
||||
import { ProductCard } from '@commerce/types/product';
|
||||
import { Layout, ListProductCardSkeleton } from 'src/components/common';
|
||||
|
||||
interface Props {
|
||||
productDetail: ProductCard[],
|
||||
}
|
||||
export default function Home({ productDetail }: Props) {
|
||||
return (
|
||||
<>
|
||||
<p>
|
||||
TOTAL: {productDetail}
|
||||
</p>
|
||||
{/* {JSON.stringify(productDetail)} */}
|
||||
{/* <ListProductCardSkeleton /> */}
|
||||
{/* <ListProductCardSkeleton count={1} /> */}
|
||||
<ListProductCardSkeleton count={10} />
|
||||
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ab qui magnam debitis ex laborum laboriosam suscipit! Totam excepturi eum libero.
|
||||
<ListProductCardSkeleton count={10} isWrap/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -22,28 +24,9 @@ export async function getServerSideProps({
|
||||
locale,
|
||||
locales,
|
||||
}: GetStaticPropsContext) {
|
||||
const config = { locale, locales }
|
||||
|
||||
const productsPromise = commerce.getProduct({
|
||||
// const productsPromise = commerce.getAllFacets({
|
||||
variables: {
|
||||
slug: "hand-trowel"
|
||||
// filter: {
|
||||
// name: {
|
||||
// contains: 'ca'
|
||||
// }
|
||||
// }
|
||||
},
|
||||
config,
|
||||
// preview,
|
||||
// Saleor provider only
|
||||
...({ featured: true } as any),
|
||||
})
|
||||
|
||||
const { product } = await productsPromise
|
||||
const productDetail = JSON.stringify(product)
|
||||
return {
|
||||
props: { productDetail },
|
||||
props: {},
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user