mirror of
https://github.com/vercel/commerce.git
synced 2025-06-20 06:01:21 +00:00
* TEC-252: Base integration with commercetools using fetchers for REST and GraphQL endpoints * TEC-252: WIP commenting some components that are failing while we don't have all the hooks defined * add sdk integration * TEC-256: Implementing product search * TEC-256: removing unnecessary env variables * TEC-256: review comments * TEC-256: other remaining review fixes Co-authored-by: nicossosa93 <nicolas.sosa@devgurus.io>
41 lines
942 B
TypeScript
41 lines
942 B
TypeScript
import { CommercetoolsConfig, Provider } from '@framework/api'
|
|
import { OperationContext } from '@commerce/api/operations'
|
|
|
|
export type Page = any
|
|
|
|
export type GetAllPagesResult<
|
|
T extends { pages: any[] } = { pages: Page[] }
|
|
> = T
|
|
|
|
export default function getAllPagesOperation({
|
|
commerce,
|
|
}: OperationContext<Provider>) {
|
|
async function getAllPages(opts?: {
|
|
config?: Partial<CommercetoolsConfig>
|
|
preview?: boolean
|
|
}): Promise<GetAllPagesResult>
|
|
|
|
async function getAllPages<T extends { pages: any[] }>(opts: {
|
|
url: string
|
|
config?: Partial<CommercetoolsConfig>
|
|
preview?: boolean
|
|
}): Promise<GetAllPagesResult<T>>
|
|
|
|
async function getAllPages({
|
|
config: cfg,
|
|
preview,
|
|
}: {
|
|
url?: string
|
|
config?: Partial<CommercetoolsConfig>
|
|
preview?: boolean
|
|
} = {}): Promise<GetAllPagesResult> {
|
|
const config = commerce.getConfig(cfg)
|
|
|
|
return {
|
|
pages: [],
|
|
}
|
|
}
|
|
|
|
return getAllPages
|
|
}
|