mirror of
https://github.com/vercel/commerce.git
synced 2025-03-28 16:25:53 +00:00
* Add ordercloud provider * Fix provider errors * Make submit checkout optional * Make submit checkout optional * Remove nullables when creating endpoint type * Update readme * Log checkout error * Log error * Save token to cookie * Update fetch rest * Use token at checkout Co-authored-by: Luis Alvarez <luis@vercel.com>
28 lines
797 B
TypeScript
28 lines
797 B
TypeScript
import type { CustomerCardSchema } from '../../../../types/customer/card'
|
|
import type { OrdercloudAPI } from '../../..'
|
|
|
|
import { GetAPISchema, createEndpoint } from '@commerce/api'
|
|
import customerCardEndpoint from '@commerce/api/endpoints/customer/card'
|
|
|
|
import getCards from './get-cards'
|
|
import addItem from './add-item'
|
|
import updateItem from './update-item'
|
|
import removeItem from './remove-item'
|
|
|
|
export type CustomerCardAPI = GetAPISchema<OrdercloudAPI, CustomerCardSchema>
|
|
export type CustomerCardEndpoint = CustomerCardAPI['endpoint']
|
|
|
|
export const handlers: CustomerCardEndpoint['handlers'] = {
|
|
getCards,
|
|
addItem,
|
|
updateItem,
|
|
removeItem,
|
|
}
|
|
|
|
const customerCardApi = createEndpoint<CustomerCardAPI>({
|
|
handler: customerCardEndpoint,
|
|
handlers,
|
|
})
|
|
|
|
export default customerCardApi
|