mirror of
https://github.com/vercel/commerce.git
synced 2025-05-17 06:56:59 +00:00
fix build failed in vendor
Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
parent
c2fa21c7ba
commit
ea7714d9b6
@ -3,16 +3,10 @@ import { GetCollectionsQuery } from '../../../schema'
|
|||||||
import { arrayToTree } from '../../utils/array-to-tree'
|
import { arrayToTree } from '../../utils/array-to-tree'
|
||||||
import { getCollectionsQuery } from '../../utils/queries/get-collections-query'
|
import { getCollectionsQuery } from '../../utils/queries/get-collections-query'
|
||||||
import { OperationContext } from '@vercel/commerce/api/operations'
|
import { OperationContext } from '@vercel/commerce/api/operations'
|
||||||
import { Category } from '@vercel/commerce/types/site'
|
import { GetSiteInfoOperation } from '@vercel/commerce/types/site'
|
||||||
|
|
||||||
export type GetSiteInfoResult<
|
|
||||||
T extends { categories: any[]; brands: any[] } = {
|
|
||||||
categories: Category[]
|
|
||||||
brands: any[]
|
|
||||||
}
|
|
||||||
> = T
|
|
||||||
|
|
||||||
export default function getSiteInfoOperation({
|
export default function getSiteInfoOperation<T extends GetSiteInfoOperation>({
|
||||||
commerce,
|
commerce,
|
||||||
}: OperationContext<Provider>) {
|
}: OperationContext<Provider>) {
|
||||||
async function getSiteInfo({
|
async function getSiteInfo({
|
||||||
@ -24,7 +18,7 @@ export default function getSiteInfoOperation({
|
|||||||
variables?: any
|
variables?: any
|
||||||
config?: Partial<VendureConfig>
|
config?: Partial<VendureConfig>
|
||||||
preview?: boolean
|
preview?: boolean
|
||||||
} = {}): Promise<GetSiteInfoResult> {
|
} = {}): Promise<T['data']> {
|
||||||
const config = commerce.getConfig(cfg)
|
const config = commerce.getConfig(cfg)
|
||||||
// RecursivePartial forces the method to check for every prop in the data, which is
|
// RecursivePartial forces the method to check for every prop in the data, which is
|
||||||
// required in case there's a custom `query`
|
// required in case there's a custom `query`
|
||||||
|
@ -11,13 +11,11 @@ export async function getSearchStaticProps({
|
|||||||
const pagesPromise = commerce.getAllPages({ config, preview })
|
const pagesPromise = commerce.getAllPages({ config, preview })
|
||||||
const siteInfoPromise = commerce.getSiteInfo({ config, preview })
|
const siteInfoPromise = commerce.getSiteInfo({ config, preview })
|
||||||
const { pages } = await pagesPromise
|
const { pages } = await pagesPromise
|
||||||
const { categories, brands, navigation } = await siteInfoPromise
|
const sieInfo = await siteInfoPromise
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
pages,
|
pages,
|
||||||
categories,
|
...sieInfo
|
||||||
brands,
|
|
||||||
...(navigation ? { navigation } : {}),
|
|
||||||
},
|
},
|
||||||
revalidate: 200,
|
revalidate: 200,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user