mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 23:46:58 +00:00
26 lines
626 B
TypeScript
26 lines
626 B
TypeScript
import { GetAPISchema, createEndpoint } from '@commerce/api'
|
|
import cartEndpoint from '@commerce/api/endpoints/cart'
|
|
import type { KiboCommerceAPI } from '../..'
|
|
import getCart from './get-cart';
|
|
import addItem from './add-item';
|
|
import updateItem from './update-item'
|
|
import removeItem from './remove-item'
|
|
|
|
export type CartAPI = GetAPISchema<KiboCommerceAPI, any>
|
|
|
|
export type CartEndpoint = CartAPI['endpoint']
|
|
|
|
export const handlers: CartEndpoint['handlers'] = {
|
|
getCart,
|
|
addItem,
|
|
updateItem,
|
|
removeItem,
|
|
}
|
|
|
|
const cartApi = createEndpoint<CartAPI>({
|
|
handler: cartEndpoint,
|
|
handlers,
|
|
})
|
|
|
|
export default cartApi
|