mirror of
https://github.com/vercel/commerce.git
synced 2025-06-08 01:06:59 +00:00
Add get-page operator
Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
parent
29b0e064a9
commit
5de4e77e21
@ -1,11 +1,30 @@
|
|||||||
export type Page = any
|
import type {
|
||||||
export type GetPageResult = { page?: Page }
|
OperationContext,
|
||||||
|
OperationOptions,
|
||||||
|
} from '@vercel/commerce/api/operations'
|
||||||
|
import { GetPageOperation } from '../../types/page'
|
||||||
|
import { Provider, OpenCommerceConfig } from '..'
|
||||||
|
|
||||||
export type PageVariables = {
|
type Page = any
|
||||||
id: number
|
type GetPageResult = { page?: Page }
|
||||||
}
|
|
||||||
|
export default function getPageOperation({
|
||||||
|
commerce,
|
||||||
|
}: OperationContext<Provider>) {
|
||||||
|
async function getPage<T extends GetPageOperation>(opts: {
|
||||||
|
variables: T['variables']
|
||||||
|
config?: Partial<OpenCommerceConfig>
|
||||||
|
preview?: boolean
|
||||||
|
}): Promise<T['data']>
|
||||||
|
|
||||||
|
async function getPage<T extends GetPageOperation>(
|
||||||
|
opts: {
|
||||||
|
variables: T['variables']
|
||||||
|
config?: Partial<OpenCommerceConfig>
|
||||||
|
preview?: boolean
|
||||||
|
} & OperationOptions
|
||||||
|
): Promise<T['data']>
|
||||||
|
|
||||||
export default function getPageOperation() {
|
|
||||||
function getPage(): Promise<GetPageResult> {
|
function getPage(): Promise<GetPageResult> {
|
||||||
return Promise.resolve({})
|
return Promise.resolve({})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user