mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 13:41:22 +00:00
updated reference to operation
This commit is contained in:
parent
3fe75a2d67
commit
c2a5904e01
@ -10,7 +10,6 @@ import { ProductView } from '@components/product'
|
|||||||
|
|
||||||
import { getConfig } from '@framework/api'
|
import { getConfig } from '@framework/api'
|
||||||
import getProduct from '@framework/product/get-product'
|
import getProduct from '@framework/product/get-product'
|
||||||
import getAllProductPaths from '@framework/product/get-all-product-paths'
|
|
||||||
|
|
||||||
export async function getStaticProps({
|
export async function getStaticProps({
|
||||||
params,
|
params,
|
||||||
@ -39,18 +38,18 @@ export async function getStaticProps({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getStaticPaths({ locales }: GetStaticPathsContext) {
|
export async function getStaticPaths({ locales }: GetStaticPathsContext) {
|
||||||
const { products } = await getAllProductPaths()
|
const { products } = await commerce.getAllProductPaths()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
paths: locales
|
paths: locales
|
||||||
? locales.reduce<string[]>((arr, locale) => {
|
? locales.reduce<string[]>((arr, locale) => {
|
||||||
// Add a product path for every locale
|
// Add a product path for every locale
|
||||||
products.forEach((product) => {
|
products.forEach((product) => {
|
||||||
arr.push(`/${locale}/product${product.node.path}`)
|
arr.push(`/${locale}/product${product.path}`)
|
||||||
})
|
})
|
||||||
return arr
|
return arr
|
||||||
}, [])
|
}, [])
|
||||||
: products.map((product) => `/product${product.node.path}`),
|
: products.map((product) => `/product${product.path}`),
|
||||||
fallback: 'blocking',
|
fallback: 'blocking',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user