Updated pages to include BC pages

This commit is contained in:
Luis Alvarez
2020-10-15 18:55:39 -05:00
parent 214cb49fb4
commit f60ee2d9ec
5 changed files with 15 additions and 14 deletions

View File

@@ -1,5 +1,6 @@
import { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
import { useRouter } from 'next/router'
import getAllPages from '@lib/bigcommerce/api/operations/get-all-pages'
import getProduct from '@lib/bigcommerce/api/operations/get-product'
import { Layout } from '@components/core'
import { ProductView } from '@components/product'
@@ -8,6 +9,7 @@ import getAllProductPaths from '@lib/bigcommerce/api/operations/get-all-product-
export async function getStaticProps({
params,
}: GetStaticPropsContext<{ slug: string }>) {
const { pages } = await getAllPages()
const { product } = await getProduct({ variables: { slug: params!.slug } })
if (!product) {
@@ -15,9 +17,7 @@ export async function getStaticProps({
}
return {
props: {
product,
},
props: { pages, product },
revalidate: 200,
}
}