forked from crowetic/commerce
Updated pages to include BC pages
This commit is contained in:
parent
214cb49fb4
commit
f60ee2d9ec
@ -1,10 +1,12 @@
|
|||||||
import { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
import { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
||||||
|
import getAllPages from '@lib/bigcommerce/api/operations/get-all-pages'
|
||||||
import { Layout } from '@components/core'
|
import { Layout } from '@components/core'
|
||||||
import { Container } from '@components/ui'
|
import { Container } from '@components/ui'
|
||||||
|
|
||||||
export async function getStaticProps({ preview }: GetStaticPropsContext) {
|
export async function getStaticProps({ preview }: GetStaticPropsContext) {
|
||||||
|
const { pages } = await getAllPages()
|
||||||
return {
|
return {
|
||||||
props: {},
|
props: { pages },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
import { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
import { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
||||||
import getAllProducts from '@lib/bigcommerce/api/operations/get-all-products'
|
import getAllPages from '@lib/bigcommerce/api/operations/get-all-pages'
|
||||||
import { Layout } from '@components/core'
|
import { Layout } from '@components/core'
|
||||||
import { Container } from '@components/ui'
|
import { Container } from '@components/ui'
|
||||||
import getSiteInfo from '@lib/bigcommerce/api/operations/get-site-info'
|
|
||||||
|
|
||||||
export async function getStaticProps({ preview }: GetStaticPropsContext) {
|
export async function getStaticProps({ preview }: GetStaticPropsContext) {
|
||||||
const { products } = await getAllProducts()
|
const { pages } = await getAllPages()
|
||||||
const { categories, brands } = await getSiteInfo()
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: { products, categories, brands },
|
props: { pages },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
import { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
||||||
import { useRouter } from 'next/router'
|
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 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'
|
||||||
@ -8,6 +9,7 @@ import getAllProductPaths from '@lib/bigcommerce/api/operations/get-all-product-
|
|||||||
export async function getStaticProps({
|
export async function getStaticProps({
|
||||||
params,
|
params,
|
||||||
}: GetStaticPropsContext<{ slug: string }>) {
|
}: GetStaticPropsContext<{ slug: string }>) {
|
||||||
|
const { pages } = await getAllPages()
|
||||||
const { product } = await getProduct({ variables: { slug: params!.slug } })
|
const { product } = await getProduct({ variables: { slug: params!.slug } })
|
||||||
|
|
||||||
if (!product) {
|
if (!product) {
|
||||||
@ -15,9 +17,7 @@ export async function getStaticProps({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: { pages, product },
|
||||||
product,
|
|
||||||
},
|
|
||||||
revalidate: 200,
|
revalidate: 200,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
|||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import cn from 'classnames'
|
import cn from 'classnames'
|
||||||
|
import getAllPages from '@lib/bigcommerce/api/operations/get-all-pages'
|
||||||
import getSiteInfo from '@lib/bigcommerce/api/operations/get-site-info'
|
import getSiteInfo from '@lib/bigcommerce/api/operations/get-site-info'
|
||||||
import useSearch from '@lib/bigcommerce/products/use-search'
|
import useSearch from '@lib/bigcommerce/products/use-search'
|
||||||
import { Layout } from '@components/core'
|
import { Layout } from '@components/core'
|
||||||
@ -17,10 +18,11 @@ import {
|
|||||||
import { range } from 'lodash'
|
import { range } from 'lodash'
|
||||||
|
|
||||||
export async function getStaticProps({ preview }: GetStaticPropsContext) {
|
export async function getStaticProps({ preview }: GetStaticPropsContext) {
|
||||||
|
const { pages } = await getAllPages()
|
||||||
const { categories, brands } = await getSiteInfo()
|
const { categories, brands } = await getSiteInfo()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: { categories, brands },
|
props: { pages, categories, brands },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 getAllPages from '@lib/bigcommerce/api/operations/get-all-pages'
|
||||||
import { Layout } from '@components/core'
|
import { Layout } from '@components/core'
|
||||||
import { Container } from '@components/ui'
|
import { Container } from '@components/ui'
|
||||||
import { WishlistCard } from '@components/wishlist'
|
import { WishlistCard } from '@components/wishlist'
|
||||||
@ -7,11 +7,11 @@ import { WishlistCard } from '@components/wishlist'
|
|||||||
import getSiteInfo from '@lib/bigcommerce/api/operations/get-site-info'
|
import getSiteInfo from '@lib/bigcommerce/api/operations/get-site-info'
|
||||||
|
|
||||||
export async function getStaticProps({ preview }: GetStaticPropsContext) {
|
export async function getStaticProps({ preview }: GetStaticPropsContext) {
|
||||||
const { products } = await getAllProducts()
|
const { pages } = await getAllPages()
|
||||||
const { categories, brands } = await getSiteInfo()
|
const { categories, brands } = await getSiteInfo()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: { products, categories, brands },
|
props: { pages, categories, brands },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user