mirror of
https://github.com/vercel/commerce.git
synced 2025-07-25 11:11:24 +00:00
Removed commerce.endpoint
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { GetAPISchema } from '@commerce/api'
|
||||
import { GetAPISchema, createEndpoint } from '@commerce/api'
|
||||
import wishlist from '@commerce/api/endpoints/wishlist'
|
||||
import type { WishlistSchema } from '../../../types/wishlist'
|
||||
import type { BigcommerceAPI } from '../..'
|
||||
import getWishlist from './get-wishlist'
|
||||
@@ -9,4 +10,15 @@ export type WishlistAPI = GetAPISchema<BigcommerceAPI, WishlistSchema>
|
||||
|
||||
export type WishlistEndpoint = WishlistAPI['endpoint']
|
||||
|
||||
export const handlers = { getWishlist, addItem, removeItem }
|
||||
export const handlers: WishlistEndpoint['handlers'] = {
|
||||
getWishlist,
|
||||
addItem,
|
||||
removeItem,
|
||||
}
|
||||
|
||||
const wishlistEndpoint = createEndpoint({
|
||||
handler: wishlist as WishlistAPI['endpoint']['handler'],
|
||||
handlers,
|
||||
})
|
||||
|
||||
export default wishlistEndpoint
|
||||
|
@@ -134,19 +134,8 @@ export type BigcommerceAPI<P extends Provider = Provider> = CommerceAPI<P>
|
||||
|
||||
export function getCommerceApi<P extends Provider>(
|
||||
customProvider: P = provider as any
|
||||
) {
|
||||
const api: BigcommerceAPI<P> = commerceApi(customProvider)
|
||||
|
||||
return Object.assign(api, {
|
||||
endpoint<E extends APIs>(
|
||||
context: E['endpoint'] & {
|
||||
config?: P['config']
|
||||
options?: E['schema']['endpoint']['options']
|
||||
}
|
||||
): NextApiHandler {
|
||||
return getEndpoint(api, context)
|
||||
},
|
||||
})
|
||||
): BigcommerceAPI<P> {
|
||||
return commerceApi(customProvider)
|
||||
}
|
||||
|
||||
export function getConfig(userConfig?: Partial<BigcommerceConfig>) {
|
||||
|
Reference in New Issue
Block a user