mirror of
https://github.com/vercel/commerce.git
synced 2025-03-14 22:42:33 +00:00
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 getAllPages from '@lib/bigcommerce/api/operations/get-all-pages'
|
||||
import { Layout } from '@components/core'
|
||||
import { Container } from '@components/ui'
|
||||
|
||||
export async function getStaticProps({ preview }: GetStaticPropsContext) {
|
||||
const { pages } = await getAllPages()
|
||||
return {
|
||||
props: {},
|
||||
props: { pages },
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,12 @@
|
||||
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 { Container } from '@components/ui'
|
||||
import getSiteInfo from '@lib/bigcommerce/api/operations/get-site-info'
|
||||
|
||||
export async function getStaticProps({ preview }: GetStaticPropsContext) {
|
||||
const { products } = await getAllProducts()
|
||||
const { categories, brands } = await getSiteInfo()
|
||||
|
||||
const { pages } = await getAllPages()
|
||||
return {
|
||||
props: { products, categories, brands },
|
||||
props: { pages },
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
||||
import { useRouter } from 'next/router'
|
||||
import Link from 'next/link'
|
||||
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 useSearch from '@lib/bigcommerce/products/use-search'
|
||||
import { Layout } from '@components/core'
|
||||
@ -17,10 +18,11 @@ import {
|
||||
import { range } from 'lodash'
|
||||
|
||||
export async function getStaticProps({ preview }: GetStaticPropsContext) {
|
||||
const { pages } = await getAllPages()
|
||||
const { categories, brands } = await getSiteInfo()
|
||||
|
||||
return {
|
||||
props: { categories, brands },
|
||||
props: { pages, categories, brands },
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
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 { Container } from '@components/ui'
|
||||
import { WishlistCard } from '@components/wishlist'
|
||||
@ -7,11 +7,11 @@ import { WishlistCard } from '@components/wishlist'
|
||||
import getSiteInfo from '@lib/bigcommerce/api/operations/get-site-info'
|
||||
|
||||
export async function getStaticProps({ preview }: GetStaticPropsContext) {
|
||||
const { products } = await getAllProducts()
|
||||
const { pages } = await getAllPages()
|
||||
const { categories, brands } = await getSiteInfo()
|
||||
|
||||
return {
|
||||
props: { products, categories, brands },
|
||||
props: { pages, categories, brands },
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user