Use the query

This commit is contained in:
Luis Alvarez
2020-09-30 13:36:02 -05:00
parent 9ca977c44f
commit b9be9ea749
4 changed files with 26 additions and 12 deletions

View File

@@ -1,6 +1,20 @@
import { Layout } from "@components/core";
import { GetStaticPropsContext, InferGetStaticPropsType } from 'next';
import { commerce } from 'lib/commerce-api';
import { Layout } from '@components/core';
export async function getStaticProps({ preview }: GetStaticPropsContext) {
const products = await commerce.getAllProducts();
return {
props: { products },
};
}
export default function Home({
products,
}: InferGetStaticPropsType<typeof getStaticProps>) {
console.log('PRODUCTS', products);
export default function Home() {
return (
<Layout>
<div className="h-full grid grid-cols-1 h-full lg:grid-cols-3 lg:grid-rows-2">