forked from crowetic/commerce
Test build
This commit is contained in:
parent
3cedd7ea97
commit
6309713c04
@ -1,14 +1,14 @@
|
|||||||
import { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
import { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import getProduct from 'lib/bigcommerce/api/operations/get-product'
|
// import getProduct from 'lib/bigcommerce/api/operations/get-product'
|
||||||
import { Layout } from '@components/core'
|
import { Layout } from '@components/core'
|
||||||
import { ProductView } from '@components/product'
|
import { ProductView } from '@components/product'
|
||||||
import getAllProductPaths from 'lib/bigcommerce/api/operations/get-all-product-paths'
|
// import getAllProductPaths from '@lib/bigcommerce/api/operations/get-all-product-paths'
|
||||||
|
|
||||||
export async function getStaticProps({
|
export async function getStaticProps({
|
||||||
params,
|
params,
|
||||||
}: GetStaticPropsContext<{ slug: string }>) {
|
}: GetStaticPropsContext<{ slug: string }>) {
|
||||||
const { product } = await getProduct({ variables: { slug: params!.slug } })
|
// const { product } = await getProduct({ variables: { slug: params!.slug } })
|
||||||
const productData = {
|
const productData = {
|
||||||
name: 'T-Shirt',
|
name: 'T-Shirt',
|
||||||
description: `
|
description: `
|
||||||
@ -26,7 +26,7 @@ export async function getStaticProps({
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
product,
|
// product,
|
||||||
productData,
|
productData,
|
||||||
},
|
},
|
||||||
revalidate: 200,
|
revalidate: 200,
|
||||||
@ -34,15 +34,12 @@ export async function getStaticProps({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const { products } = await getAllProductPaths()
|
// const { products } = await getAllProductPaths()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
paths: products.map((product) => {
|
paths: [],
|
||||||
const { path } = product!.node
|
// paths: products.map((product) => `/product${product!.node.path}`),
|
||||||
// Exclude the slashes: `/slug/` -> `slug`
|
fallback: 'unstable_blocking',
|
||||||
return { params: { slug: path.substring(1, path.length - 1) } }
|
|
||||||
}),
|
|
||||||
fallback: false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user