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
848 B
TypeScript
28 lines
848 B
TypeScript
import type { CustomerAddressSchema } from '../../../../types/customer/address'
|
|
import type { OrdercloudAPI } from '../../..'
|
|
|
|
import { GetAPISchema, createEndpoint } from '@commerce/api'
|
|
import customerAddressEndpoint from '@commerce/api/endpoints/customer/address'
|
|
|
|
import getAddresses from './get-addresses'
|
|
import addItem from './add-item'
|
|
import updateItem from './update-item'
|
|
import removeItem from './remove-item'
|
|
|
|
export type CustomerAddressAPI = GetAPISchema<OrdercloudAPI, CustomerAddressSchema>
|
|
export type CustomerAddressEndpoint = CustomerAddressAPI['endpoint']
|
|
|
|
export const handlers: CustomerAddressEndpoint['handlers'] = {
|
|
getAddresses,
|
|
addItem,
|
|
updateItem,
|
|
removeItem,
|
|
}
|
|
|
|
const customerAddressApi = createEndpoint<CustomerAddressAPI>({
|
|
handler: customerAddressEndpoint,
|
|
handlers,
|
|
})
|
|
|
|
export default customerAddressApi
|