mirror of
https://github.com/vercel/commerce.git
synced 2025-06-20 14:11:20 +00:00
parallel requests
This commit is contained in:
parent
993525c553
commit
58f25ad8c9
@ -19,13 +19,16 @@ export async function getStaticProps({
|
|||||||
preview,
|
preview,
|
||||||
}: GetStaticPropsContext<{ slug: string }>) {
|
}: GetStaticPropsContext<{ slug: string }>) {
|
||||||
const config = getConfig({ locale })
|
const config = getConfig({ locale })
|
||||||
const { pages } = await getAllPages({ config, preview })
|
const pagesPromise = getAllPages({ config, preview })
|
||||||
const { product } = await getProduct({
|
const productPromise = getProduct({
|
||||||
variables: { slug: params!.slug },
|
variables: { slug: params!.slug },
|
||||||
config,
|
config,
|
||||||
preview,
|
preview,
|
||||||
})
|
})
|
||||||
const { categories } = await getSiteInfo({ config, preview })
|
const siteInfoPromise = getSiteInfo({ config, preview })
|
||||||
|
const { pages } = await pagesPromise
|
||||||
|
const { product } = await productPromise
|
||||||
|
const { categories } = await siteInfoPromise
|
||||||
|
|
||||||
if (!product) {
|
if (!product) {
|
||||||
throw new Error(`Product with slug '${params!.slug}' not found`)
|
throw new Error(`Product with slug '${params!.slug}' not found`)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user