mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 05:31:22 +00:00
35 lines
963 B
TypeScript
35 lines
963 B
TypeScript
import { EndpointSchema } from '@commerce/api'
|
|
import getCart from './get-cart'
|
|
import addItem from './add-item'
|
|
import updateItem from './handlers/update-item'
|
|
import removeItem from './handlers/remove-item'
|
|
import type {
|
|
GetCartHandlerBody,
|
|
AddCartItemHandlerBody,
|
|
UpdateCartItemHandlerBody,
|
|
RemoveCartItemHandlerBody,
|
|
Cart,
|
|
} from '../../types'
|
|
import type { CommerceAPIEndpoints } from '..'
|
|
|
|
export type CartEndpointSchema = EndpointSchema<
|
|
'cart',
|
|
{
|
|
options: {}
|
|
operations: {
|
|
getCart: {
|
|
data: Cart | null
|
|
body: GetCartHandlerBody
|
|
options: { yay: string }
|
|
}
|
|
addItem: { data: Cart; body: AddCartItemHandlerBody; options: {} }
|
|
updateItem: { data: Cart; body: UpdateCartItemHandlerBody; options: {} }
|
|
removeItem: { data: Cart; body: RemoveCartItemHandlerBody; options: {} }
|
|
}
|
|
}
|
|
>
|
|
|
|
export type CartAPI = CommerceAPIEndpoints['cart']
|
|
|
|
export const operations = { getCart, addItem }
|