4
0
forked from crowetic/commerce

Undo change

This commit is contained in:
Luis Alvarez 2020-10-26 22:46:09 -05:00
parent 2f37fa46a9
commit ec9953790c

View File

@ -26,7 +26,7 @@ export const fetcher: HookFetcher<Cart | null, RemoveItemBody> = (
}
export function extendHook(customFetcher: typeof fetcher) {
const useRemoveItem = () => {
const useRemoveItem = (item?: any) => {
const { mutate } = useCart()
const fn = useCartRemoveItem<Cart | null, RemoveItemBody>(
defaultOpts,
@ -35,7 +35,7 @@ export function extendHook(customFetcher: typeof fetcher) {
return useCallback(
async function removeItem(input: RemoveItemInput) {
const data = await fn({ itemId: input.id })
const data = await fn({ itemId: input.id ?? item?.id })
await mutate(data, false)
return data
},