commerce/framework/module-data/ProductSearchData.ts
Joel Varty d9fe7d8e6b merged
2021-06-17 17:37:32 -04:00

26 lines
561 B
TypeScript

import commerce from '@lib/api/commerce'
const getCustomInitialProps = async ({ agility, channelName, languageCode }:any) => {
//TODO: pass the locale and preview mode as props...
const locale = "en-US"
const preview = false
const config = { locale, locales: [locale] }
const pagesPromise = commerce.getAllPages({ config, preview })
const siteInfoPromise = commerce.getSiteInfo({ config, preview })
const { categories, brands } = await siteInfoPromise
return {
categories,
brands,
}
}
export default {
getCustomInitialProps
}