mirror of
https://github.com/vercel/commerce.git
synced 2025-03-15 15:02:32 +00:00
20 lines
592 B
TypeScript
20 lines
592 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: products.slice(0, 6) },
|
|
}
|
|
}
|
|
|
|
export default function Home({
|
|
products,
|
|
}: InferGetStaticPropsType<typeof getStaticProps>) {
|
|
return <ProductGrid products={products} />
|
|
}
|
|
|
|
Home.Layout = Layout
|