mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Move API to new Node architecture
Signed-off-by: Loan Laux <loan@outgrow.io>
This commit is contained in:
40
framework/reactioncommerce/api/operations/get-all-pages.ts
Normal file
40
framework/reactioncommerce/api/operations/get-all-pages.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { ReactionCommerceConfig } from '../'
|
||||
import { OperationContext } from '@commerce/api/operations'
|
||||
import { Provider } from '@commerce'
|
||||
|
||||
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<ReactionCommerceConfig>
|
||||
preview?: boolean
|
||||
}): Promise<GetAllPagesResult>
|
||||
|
||||
async function getAllPages<T extends { pages: any[] }>(opts: {
|
||||
url: string
|
||||
config?: Partial<ReactionCommerceConfig>
|
||||
preview?: boolean
|
||||
}): Promise<GetAllPagesResult<T>>
|
||||
|
||||
async function getAllPages({
|
||||
config: cfg,
|
||||
preview,
|
||||
}: {
|
||||
url?: string
|
||||
config?: Partial<ReactionCommerceConfig>
|
||||
preview?: boolean
|
||||
} = {}): Promise<GetAllPagesResult> {
|
||||
const config = commerce.getConfig(cfg)
|
||||
|
||||
return {
|
||||
pages: [],
|
||||
}
|
||||
}
|
||||
|
||||
return getAllPages
|
||||
}
|
Reference in New Issue
Block a user