mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 13:41:22 +00:00
Refactor Vendure checkout api handler
This commit is contained in:
parent
ff7fd73911
commit
ece74390f3
@ -1,4 +1,3 @@
|
|||||||
import { BigcommerceConfig, getConfig } from '../../bigcommerce/api'
|
|
||||||
import { NextApiHandler } from 'next'
|
import { NextApiHandler } from 'next'
|
||||||
|
|
||||||
const checkoutApi = async (req: any, res: any, config: any) => {
|
const checkoutApi = async (req: any, res: any, config: any) => {
|
||||||
@ -45,7 +44,7 @@ export function createApiHandler<T = any, H = {}, Options extends {} = {}>(
|
|||||||
operations,
|
operations,
|
||||||
options,
|
options,
|
||||||
}: {
|
}: {
|
||||||
config?: BigcommerceConfig
|
config?: any
|
||||||
operations?: Partial<H>
|
operations?: Partial<H>
|
||||||
options?: Options extends {} ? Partial<Options> : never
|
options?: Options extends {} ? Partial<Options> : never
|
||||||
} = {}): NextApiHandler {
|
} = {}): NextApiHandler {
|
||||||
@ -53,7 +52,7 @@ export function createApiHandler<T = any, H = {}, Options extends {} = {}>(
|
|||||||
const opts = { ...defaultOptions, ...options }
|
const opts = { ...defaultOptions, ...options }
|
||||||
|
|
||||||
return function apiHandler(req, res) {
|
return function apiHandler(req, res) {
|
||||||
return handler(req, res, getConfig(config), ops, opts)
|
return handler(req, res, config, ops, opts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user