mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 05:31: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'
|
||||
|
||||
const checkoutApi = async (req: any, res: any, config: any) => {
|
||||
@ -45,7 +44,7 @@ export function createApiHandler<T = any, H = {}, Options extends {} = {}>(
|
||||
operations,
|
||||
options,
|
||||
}: {
|
||||
config?: BigcommerceConfig
|
||||
config?: any
|
||||
operations?: Partial<H>
|
||||
options?: Options extends {} ? Partial<Options> : never
|
||||
} = {}): NextApiHandler {
|
||||
@ -53,7 +52,7 @@ export function createApiHandler<T = any, H = {}, Options extends {} = {}>(
|
||||
const opts = { ...defaultOptions, ...options }
|
||||
|
||||
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