UNPKG

@shopgate/pwa-common

Version:

Common library for the Shopgate Connect PWA.

9 lines 851 B
import{connect}from'react-redux';import closeModal from"../../actions/modal/closeModal";import{getFirstModal}from"../../selectors/modal";/** * Maps the contents of the state to the component props. * @param {Object} state The current application state. * @return {Object} The extended component props. */var mapStateToProps=function mapStateToProps(state){return{modal:getFirstModal(state)};};/** * Connects the dispatch function to a callable function in the props. * @param {Function} dispatch The redux dispatch function. * @return {Object} The extended component props. */var mapDispatchToProps=function mapDispatchToProps(dispatch){return{confirm:function confirm(id){return dispatch(closeModal(id,true));},dismiss:function dismiss(id){return dispatch(closeModal(id,false));}};};export default connect(mapStateToProps,mapDispatchToProps);