UNPKG

@open-tender/store

Version:

A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API

20 lines (19 loc) 698 B
import { useAppDispatch } from '../app/hooks'; import { closeModal, resetCart, resetCustomer, resetCustomerIdentify, resetIdleState, resetMenu, resetPosCheckout, setOrderId } from '../slices'; var useResetOrder = function (callback) { var dispatch = useAppDispatch(); var resetOrder = function () { dispatch(resetIdleState()); dispatch(resetPosCheckout()); dispatch(setOrderId(null)); dispatch(resetCart()); dispatch(resetCustomerIdentify()); dispatch(resetCustomer()); dispatch(resetMenu()); dispatch(closeModal()); if (callback) callback(); }; return resetOrder; }; export default useResetOrder;