diff --git a/lib/bigcommerce/cart/use-cart-actions.tsx b/lib/bigcommerce/cart/use-cart-actions.tsx new file mode 100644 index 000000000..abb4a998e --- /dev/null +++ b/lib/bigcommerce/cart/use-cart-actions.tsx @@ -0,0 +1,13 @@ +import useAddItem from './use-add-item' +import useRemoveItem from './use-remove-item' +import useUpdateItem from './use-update-item' + +// This hook is probably not going to be used, but it's here +// to show how a commerce should be structuring it +export default function useCartActions() { + const addItem = useAddItem() + const updateItem = useUpdateItem() + const removeItem = useRemoveItem() + + return { addItem, updateItem, removeItem } +} diff --git a/lib/commerce/cart/use-cart-actions.tsx b/lib/commerce/cart/use-cart-actions.tsx new file mode 100644 index 000000000..f95219a9d --- /dev/null +++ b/lib/commerce/cart/use-cart-actions.tsx @@ -0,0 +1,16 @@ +import type { Fetcher } from '..' +import useAddItem from './use-add-item' +import useRemoveItem from './use-remove-item' +import useUpdateItem from './use-update-item' + +// This hook is probably not going to be used, but it's here +// to show how a commerce should be structuring it +export default function useCartActions( + fetcher: (fetch: Fetcher, input: Input) => T | Promise +) { + const addItem = useAddItem(fetcher) + const updateItem = useUpdateItem(fetcher) + const removeItem = useRemoveItem(fetcher) + + return { addItem, updateItem, removeItem } +}