1
0
mirror of https://github.com/vercel/commerce.git synced 2025-03-29 16:55:52 +00:00
2020-10-04 13:12:41 -05:00

20 lines
513 B
TypeScript

import { 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 }) {
const res = await fetch({ url: '/api/cart' })
// {
// method: 'POST',
// headers: {
// 'Content-Type': 'application/json',
// },
// body: JSON.stringify({ product }),
// }
}
export default function useAddItem() {
return useCartAddItem<Cart, { item: any }>(fetcher)
}