mirror of
https://github.com/vercel/commerce.git
synced 2025-03-15 15:02:32 +00:00
23 lines
622 B
TypeScript
23 lines
622 B
TypeScript
import { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
|
import getAllProducts from 'lib/bigcommerce/api/operations/get-all-products'
|
|
import { Layout } from '@components/core'
|
|
import { ProductGrid } from '@components/product'
|
|
|
|
export async function getStaticProps({ preview }: GetStaticPropsContext) {
|
|
const { products } = await getAllProducts()
|
|
return {
|
|
props: { products },
|
|
}
|
|
}
|
|
|
|
export default function Home({
|
|
products,
|
|
}: InferGetStaticPropsType<typeof getStaticProps>) {
|
|
console.log('PRODUCTS', products)
|
|
return (
|
|
<Layout>
|
|
<ProductGrid products={products} />
|
|
</Layout>
|
|
)
|
|
}
|