2020-10-01 20:40:40 -05:00
|
|
|
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'
|
2020-09-30 13:36:02 -05:00
|
|
|
|
|
|
|
export async function getStaticProps({ preview }: GetStaticPropsContext) {
|
2020-10-01 20:40:40 -05:00
|
|
|
const { products } = await getAllProducts()
|
2020-09-30 13:36:02 -05:00
|
|
|
return {
|
|
|
|
props: { products },
|
2020-10-01 20:40:40 -05:00
|
|
|
}
|
2020-09-30 13:36:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
export default function Home({
|
|
|
|
products,
|
|
|
|
}: InferGetStaticPropsType<typeof getStaticProps>) {
|
2020-10-01 20:40:40 -05:00
|
|
|
console.log('PRODUCTS', products)
|
2020-09-30 11:44:38 -05:00
|
|
|
return (
|
|
|
|
<Layout>
|
2020-10-01 17:25:48 -03:00
|
|
|
<ProductGrid products={products} />
|
2020-09-30 11:44:38 -05:00
|
|
|
</Layout>
|
2020-10-01 20:40:40 -05:00
|
|
|
)
|
2020-09-30 11:44:38 -05:00
|
|
|
}
|