mirror of
https://github.com/vercel/commerce.git
synced 2025-08-13 20:31:23 +00:00
.vscode
assets
components
config
framework
bigcommerce
commerce
local
saleor
shopify
swell
vendure
api
endpoints
operations
get-all-pages.ts
get-all-product-paths.ts
get-all-products.ts
get-customer-wishlist.ts
get-page.ts
get-product.ts
get-site-info.ts
login.ts
utils
index.ts
auth
cart
customer
product
types
utils
wishlist
.env.template
README.md
codegen.json
commerce.config.json
fetcher.ts
index.tsx
next.config.js
provider.ts
schema.d.ts
schema.graphql
lib
pages
public
.editorconfig
.env.template
.gitignore
.prettierignore
.prettierrc
README.md
codegen.bigcommerce.json
codegen.json
commerce.config.json
global.d.ts
license.md
next-env.d.ts
next.config.js
package.json
postcss.config.js
swell-js.d.ts
tailwind.config.js
tsconfig.json
46 lines
1003 B
TypeScript
46 lines
1003 B
TypeScript
import { VendureConfig, Provider } from '../'
|
|
import { OperationContext } from '@commerce/api/operations'
|
|
|
|
export type Page = any
|
|
|
|
export type GetPageResult<T extends { page?: any } = { page?: Page }> = T
|
|
|
|
export type PageVariables = {
|
|
id: number
|
|
}
|
|
|
|
export default function getPageOperation({
|
|
commerce,
|
|
}: OperationContext<Provider>) {
|
|
async function getPage(opts: {
|
|
url?: string
|
|
variables: PageVariables
|
|
config?: Partial<VendureConfig>
|
|
preview?: boolean
|
|
}): Promise<GetPageResult>
|
|
|
|
async function getPage<T extends { page?: any }, V = any>(opts: {
|
|
url: string
|
|
variables: V
|
|
config?: Partial<VendureConfig>
|
|
preview?: boolean
|
|
}): Promise<GetPageResult<T>>
|
|
|
|
async function getPage({
|
|
url,
|
|
variables,
|
|
config: cfg,
|
|
preview,
|
|
}: {
|
|
url?: string
|
|
variables: PageVariables
|
|
config?: Partial<VendureConfig>
|
|
preview?: boolean
|
|
}): Promise<GetPageResult> {
|
|
const config = commerce.getConfig(cfg)
|
|
return {}
|
|
}
|
|
|
|
return getPage
|
|
}
|