forked from crowetic/commerce
23 lines
630 B
TypeScript
23 lines
630 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>
|
|
);
|
|
}
|