mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
Added locale metadata for products and product page
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useMemo } from 'react'
|
||||
import { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
||||
import { getConfig } from '@lib/bigcommerce/api'
|
||||
import getAllProducts from '@lib/bigcommerce/api/operations/get-all-products'
|
||||
import getSiteInfo from '@lib/bigcommerce/api/operations/get-site-info'
|
||||
import getAllPages from '@lib/bigcommerce/api/operations/get-all-pages'
|
||||
@@ -12,19 +13,22 @@ export async function getStaticProps({
|
||||
preview,
|
||||
locale,
|
||||
}: GetStaticPropsContext) {
|
||||
console.log('LOCALE', locale)
|
||||
const config = getConfig({ locale })
|
||||
|
||||
const { products: featuredProducts } = await getAllProducts({
|
||||
variables: { field: 'featuredProducts', first: 6 },
|
||||
config,
|
||||
})
|
||||
const { products: bestSellingProducts } = await getAllProducts({
|
||||
variables: { field: 'bestSellingProducts', first: 6 },
|
||||
config,
|
||||
})
|
||||
const { products: newestProducts } = await getAllProducts({
|
||||
variables: { field: 'newestProducts', first: 12 },
|
||||
config,
|
||||
})
|
||||
const { categories, brands } = await getSiteInfo()
|
||||
const { pages } = await getAllPages()
|
||||
const { categories, brands } = await getSiteInfo({ config })
|
||||
const { pages } = await getAllPages({ config })
|
||||
|
||||
return {
|
||||
props: {
|
||||
|
Reference in New Issue
Block a user