@shopgate/engage
Version:
Shopgate's ENGAGE library.
8 lines • 921 B
JavaScript
import{connect}from'react-redux';import{getCurrentRoute,getCurrentPathname,getCurrentParams}from'@shopgate/pwa-common/selectors/router';import{isUserLoggedIn}from'@shopgate/pwa-common/selectors/user';import _logout from'@shopgate/pwa-common/actions/user/logout';/**
* Creates the mapStateToProps connector function.
* @returns {Function}
*/var makeMapStateToProps=function makeMapStateToProps(){return function(state){return{currentParams:getCurrentParams(state),currentPathname:getCurrentPathname(state),currentRoute:getCurrentRoute(state),isLoggedIn:isUserLoggedIn(state)};};};/**
* Maps the contents of the state to the component props.
* @param {Function} dispatch The dispatch method from the store.
* @return {Object}
*/var mapDispatchToProps=function mapDispatchToProps(dispatch){return{logout:function logout(){return dispatch(_logout());}};};export default connect(makeMapStateToProps,mapDispatchToProps);