forked from crowetic/commerce
Undo change
This commit is contained in:
parent
2f37fa46a9
commit
ec9953790c
@ -26,7 +26,7 @@ export const fetcher: HookFetcher<Cart | null, RemoveItemBody> = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function extendHook(customFetcher: typeof fetcher) {
|
export function extendHook(customFetcher: typeof fetcher) {
|
||||||
const useRemoveItem = () => {
|
const useRemoveItem = (item?: any) => {
|
||||||
const { mutate } = useCart()
|
const { mutate } = useCart()
|
||||||
const fn = useCartRemoveItem<Cart | null, RemoveItemBody>(
|
const fn = useCartRemoveItem<Cart | null, RemoveItemBody>(
|
||||||
defaultOpts,
|
defaultOpts,
|
||||||
@ -35,7 +35,7 @@ export function extendHook(customFetcher: typeof fetcher) {
|
|||||||
|
|
||||||
return useCallback(
|
return useCallback(
|
||||||
async function removeItem(input: RemoveItemInput) {
|
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)
|
await mutate(data, false)
|
||||||
return data
|
return data
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user