mirror of
https://github.com/vercel/commerce.git
synced 2025-07-25 19:21:23 +00:00
Setup provider
This commit is contained in:
@@ -1 +1,28 @@
|
||||
export default function noopApi(...args: any[]): void {}
|
||||
import type { CartSchema } from '../../../types/cart'
|
||||
import type { OrdercloudAPI } from '../..'
|
||||
|
||||
import { GetAPISchema, createEndpoint } from '@commerce/api'
|
||||
import cartEndpoint from '@commerce/api/endpoints/cart'
|
||||
|
||||
import getCart from './get-cart'
|
||||
import addItem from './add-item'
|
||||
import updateItem from './update-item'
|
||||
import removeItem from './remove-item'
|
||||
|
||||
export type CartAPI = GetAPISchema<OrdercloudAPI, CartSchema>
|
||||
|
||||
export type CartEndpoint = CartAPI['endpoint']
|
||||
|
||||
export const handlers: CartEndpoint['handlers'] = {
|
||||
getCart,
|
||||
addItem,
|
||||
updateItem,
|
||||
removeItem,
|
||||
}
|
||||
|
||||
const cartApi = createEndpoint<CartAPI>({
|
||||
handler: cartEndpoint,
|
||||
handlers,
|
||||
})
|
||||
|
||||
export default cartApi
|
||||
|
Reference in New Issue
Block a user