Add preview where applicable

This commit is contained in:
Luis Alvarez
2020-10-27 00:47:29 -05:00
parent 3e7b1f833f
commit c9b4a9ad4c
14 changed files with 57 additions and 41 deletions

View File

@@ -1,4 +1,4 @@
import {
import type {
GetStaticPathsContext,
GetStaticPropsContext,
InferGetStaticPropsType,
@@ -14,13 +14,15 @@ import getAllProductPaths from '@lib/bigcommerce/api/operations/get-all-product-
export async function getStaticProps({
params,
locale,
preview,
}: GetStaticPropsContext<{ slug: string }>) {
const config = getConfig({ locale })
const { pages } = await getAllPages({ config })
const { pages } = await getAllPages({ config, preview })
const { product } = await getProduct({
variables: { slug: params!.slug },
config,
preview,
})
if (!product) {