mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 05:31:22 +00:00
Moved getAllPages everywhere
This commit is contained in:
parent
066a53d52d
commit
9794d5e626
@ -1,6 +1,6 @@
|
||||
import type { GetStaticPropsContext } from 'next'
|
||||
import { getConfig } from '@framework/api'
|
||||
import getAllPages from '@framework/common/get-all-pages'
|
||||
import commerce from '@lib/api/commerce'
|
||||
import { Layout } from '@components/common'
|
||||
import { Container } from '@components/ui'
|
||||
|
||||
@ -9,7 +9,7 @@ export async function getStaticProps({
|
||||
locale,
|
||||
}: GetStaticPropsContext) {
|
||||
const config = getConfig({ locale })
|
||||
const { pages } = await getAllPages({ config, preview })
|
||||
const { pages } = await commerce.getAllPages({ config, preview })
|
||||
return {
|
||||
props: { pages },
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
import type { GetStaticPropsContext } from 'next'
|
||||
import { getConfig } from '@framework/api'
|
||||
import getAllPages from '@framework/common/get-all-pages'
|
||||
import useCart from '@framework/cart/use-cart'
|
||||
import usePrice from '@framework/product/use-price'
|
||||
import commerce from '@lib/api/commerce'
|
||||
import { Layout } from '@components/common'
|
||||
import { Button, Text } from '@components/ui'
|
||||
import { Bag, Cross, Check, MapPin, CreditCard } from '@components/icons'
|
||||
@ -13,7 +13,7 @@ export async function getStaticProps({
|
||||
locale,
|
||||
}: GetStaticPropsContext) {
|
||||
const config = getConfig({ locale })
|
||||
const { pages } = await getAllPages({ config, preview })
|
||||
const { pages } = await commerce.getAllPages({ config, preview })
|
||||
return {
|
||||
props: { pages },
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import commerce from '@lib/api/commerce'
|
||||
import { Layout } from '@components/common'
|
||||
import { Grid, Marquee, Hero } from '@components/ui'
|
||||
import { ProductCard } from '@components/product'
|
||||
@ -7,7 +8,6 @@ import type { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
||||
import { getConfig } from '@framework/api'
|
||||
import getAllProducts from '@framework/product/get-all-products'
|
||||
import getSiteInfo from '@framework/common/get-site-info'
|
||||
import getAllPages from '@framework/common/get-all-pages'
|
||||
|
||||
export async function getStaticProps({
|
||||
preview,
|
||||
@ -22,7 +22,7 @@ export async function getStaticProps({
|
||||
})
|
||||
|
||||
const { categories, brands } = await getSiteInfo({ config, preview })
|
||||
const { pages } = await getAllPages({ config, preview })
|
||||
const { pages } = await commerce.getAllPages({ config, preview })
|
||||
|
||||
return {
|
||||
props: {
|
||||
|
@ -1,16 +1,16 @@
|
||||
import type { GetStaticPropsContext } from 'next'
|
||||
import commerce from '@lib/api/commerce'
|
||||
import { Bag } from '@components/icons'
|
||||
import { Layout } from '@components/common'
|
||||
import { Container, Text } from '@components/ui'
|
||||
import { getConfig } from '@framework/api'
|
||||
import getAllPages from '@framework/common/get-all-pages'
|
||||
|
||||
export async function getStaticProps({
|
||||
preview,
|
||||
locale,
|
||||
}: GetStaticPropsContext) {
|
||||
const config = getConfig({ locale })
|
||||
const { pages } = await getAllPages({ config, preview })
|
||||
const { pages } = await commerce.getAllPages({ config, preview })
|
||||
return {
|
||||
props: { pages },
|
||||
}
|
||||
|
@ -4,12 +4,12 @@ import type {
|
||||
InferGetStaticPropsType,
|
||||
} from 'next'
|
||||
import { useRouter } from 'next/router'
|
||||
import commerce from '@lib/api/commerce'
|
||||
import { Layout } from '@components/common'
|
||||
import { ProductView } from '@components/product'
|
||||
|
||||
import { getConfig } from '@framework/api'
|
||||
import getProduct from '@framework/product/get-product'
|
||||
import getAllPages from '@framework/common/get-all-pages'
|
||||
import getAllProductPaths from '@framework/product/get-all-product-paths'
|
||||
|
||||
export async function getStaticProps({
|
||||
@ -18,7 +18,7 @@ export async function getStaticProps({
|
||||
preview,
|
||||
}: GetStaticPropsContext<{ slug: string }>) {
|
||||
const config = getConfig({ locale })
|
||||
const { pages } = await getAllPages({ config, preview })
|
||||
const { pages } = await commerce.getAllPages({ config, preview })
|
||||
const { product } = await getProduct({
|
||||
variables: { slug: params!.slug },
|
||||
config,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { GetStaticPropsContext } from 'next'
|
||||
import { getConfig } from '@framework/api'
|
||||
import getAllPages from '@framework/common/get-all-pages'
|
||||
import useCustomer from '@framework/customer/use-customer'
|
||||
import commerce from '@lib/api/commerce'
|
||||
import { Layout } from '@components/common'
|
||||
import { Container, Text } from '@components/ui'
|
||||
|
||||
@ -10,7 +10,7 @@ export async function getStaticProps({
|
||||
locale,
|
||||
}: GetStaticPropsContext) {
|
||||
const config = getConfig({ locale })
|
||||
const { pages } = await getAllPages({ config, preview })
|
||||
const { pages } = await commerce.getAllPages({ config, preview })
|
||||
return {
|
||||
props: { pages },
|
||||
}
|
||||
|
@ -10,11 +10,18 @@ import { Container, Grid, Skeleton } from '@components/ui'
|
||||
|
||||
import { getConfig } from '@framework/api'
|
||||
import useSearch from '@framework/product/use-search'
|
||||
import getAllPages from '@framework/common/get-all-pages'
|
||||
import getSiteInfo from '@framework/common/get-site-info'
|
||||
|
||||
import commerce from '@lib/api/commerce'
|
||||
import rangeMap from '@lib/range-map'
|
||||
|
||||
import {
|
||||
filterQuery,
|
||||
getCategoryPath,
|
||||
getDesignerPath,
|
||||
useSearchMeta,
|
||||
} from '@lib/search'
|
||||
import { Product } from '@commerce/types'
|
||||
|
||||
// TODO(bc) Remove this. This should come from the API
|
||||
import getSlug from '@lib/get-slug'
|
||||
|
||||
@ -26,20 +33,12 @@ const SORT = Object.entries({
|
||||
'price-desc': 'Price: High to low',
|
||||
})
|
||||
|
||||
import {
|
||||
filterQuery,
|
||||
getCategoryPath,
|
||||
getDesignerPath,
|
||||
useSearchMeta,
|
||||
} from '@lib/search'
|
||||
import { Product } from '@commerce/types'
|
||||
|
||||
export async function getStaticProps({
|
||||
preview,
|
||||
locale,
|
||||
}: GetStaticPropsContext) {
|
||||
const config = getConfig({ locale })
|
||||
const { pages } = await getAllPages({ config, preview })
|
||||
const { pages } = await commerce.getAllPages({ config, preview })
|
||||
const { categories, brands } = await getSiteInfo({ config, preview })
|
||||
return {
|
||||
props: {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import type { GetStaticPropsContext } from 'next'
|
||||
import commerce from '@lib/api/commerce'
|
||||
import { Heart } from '@components/icons'
|
||||
import { Layout } from '@components/common'
|
||||
import { Text, Container } from '@components/ui'
|
||||
@ -7,7 +8,6 @@ import { getConfig } from '@framework/api'
|
||||
import { useCustomer } from '@framework/customer'
|
||||
import { WishlistCard } from '@components/wishlist'
|
||||
import useWishlist from '@framework/wishlist/use-wishlist'
|
||||
import getAllPages from '@framework/common/get-all-pages'
|
||||
|
||||
export async function getStaticProps({
|
||||
preview,
|
||||
@ -21,7 +21,7 @@ export async function getStaticProps({
|
||||
}
|
||||
|
||||
const config = getConfig({ locale })
|
||||
const { pages } = await getAllPages({ config, preview })
|
||||
const { pages } = await commerce.getAllPages({ config, preview })
|
||||
return {
|
||||
props: {
|
||||
pages,
|
||||
|
Loading…
x
Reference in New Issue
Block a user