mirror of
https://github.com/vercel/commerce.git
synced 2025-06-20 06:01:21 +00:00
26 lines
670 B
TypeScript
26 lines
670 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 { pages } = await getAllPages({ config, preview })
|
|
const { categories, brands } = await getSiteInfo({ config, preview })
|
|
return {
|
|
props: {
|
|
pages,
|
|
categories,
|
|
brands,
|
|
},
|
|
}
|
|
}
|
|
|
|
export type SearchPropsType = InferGetStaticPropsType<
|
|
typeof getSearchStaticProps
|
|
>
|