mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 21:51:21 +00:00
28 lines
748 B
TypeScript
28 lines
748 B
TypeScript
import type { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
|
|
|
|
import { getConfig } from '@framework/api'
|
|
import getAllPages from '@framework/common/get-all-pages'
|
|
import getSiteInfo from '@framework/common/get-site-info'
|
|
|
|
export async function getSearchStaticProps({
|
|
preview,
|
|
locale,
|
|
}: GetStaticPropsContext) {
|
|
const config = getConfig({ locale })
|
|
const pagesPromise = getAllPages({ config, preview })
|
|
const siteInfoPromise = getSiteInfo({ config, preview })
|
|
const { pages } = await pagesPromise
|
|
const { categories, brands } = await siteInfoPromise
|
|
return {
|
|
props: {
|
|
pages,
|
|
categories,
|
|
brands,
|
|
},
|
|
}
|
|
}
|
|
|
|
export type SearchPropsType = InferGetStaticPropsType<
|
|
typeof getSearchStaticProps
|
|
>
|