forked from crowetic/commerce
Undo changes
This commit is contained in:
parent
6309713c04
commit
d9ee4086b9
@ -1,5 +1,5 @@
|
|||||||
import { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
import { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
||||||
import getAllProducts from 'lib/bigcommerce/api/operations/get-all-products'
|
import getAllProducts from '@lib/bigcommerce/api/operations/get-all-products'
|
||||||
import { Layout } from '@components/core'
|
import { Layout } from '@components/core'
|
||||||
import { ProductGrid } from '@components/product'
|
import { ProductGrid } from '@components/product'
|
||||||
|
|
||||||
|
@ -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,11 +34,10 @@ export async function getStaticProps({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
// const { products } = await getAllProductPaths()
|
const { products } = await getAllProductPaths()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
paths: [],
|
paths: products.map((product) => `/product${product!.node.path}`),
|
||||||
// paths: products.map((product) => `/product${product!.node.path}`),
|
|
||||||
fallback: 'unstable_blocking',
|
fallback: 'unstable_blocking',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user