@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
27 lines (26 loc) • 959 B
JavaScript
import { useAppDispatch, useAppSelector } from '../app/hooks';
import { resetCart, resetCustomer, resetCustomerIdentify, resetIdleState, resetMenu, resetPosCheckout, selectKioskConfig, setOrderId } from '../slices';
var CancelButton = function (_a) {
var navigate = _a.navigate, children = _a.children, route = _a.route;
var dispatch = useAppDispatch();
var config = useAppSelector(selectKioskConfig).cancelButton;
var startOver = function () {
dispatch(resetPosCheckout());
dispatch(setOrderId(null));
dispatch(resetCart());
dispatch(resetCustomerIdentify());
dispatch(resetCustomer());
dispatch(resetMenu());
dispatch(resetIdleState());
navigate('/');
};
var handlers = { startOver: startOver };
if (!config)
return null;
return children({
config: config,
handlers: handlers,
route: route
});
};
export default CancelButton;