mirror of
https://github.com/vercel/commerce.git
synced 2025-04-28 13:57:50 +00:00
12 lines
386 B
TypeScript
12 lines
386 B
TypeScript
import type { Fetcher } from '@lib/commerce'
|
|
import { default as useCartAddItem } from '@lib/commerce/cart/use-add-item'
|
|
import { Cart } from '.'
|
|
|
|
async function fetcher(fetch: Fetcher<Cart>, { item }: { item: any }) {
|
|
return fetch({ url: '/api/cart', method: 'POST', body: { item } })
|
|
}
|
|
|
|
export default function useAddItem() {
|
|
return useCartAddItem<Cart, { item: any }>(fetcher)
|
|
}
|