Files
bigcapital/client/src/containers/Authentication/withAuthentication.js
2020-06-02 19:47:38 +02:00

13 lines
411 B
JavaScript

import { isAuthenticated } from 'store/authentication/authentication.reducer'
import { connect } from 'react-redux';
export default (mapState) => {
const mapStateToProps = (state, props) => {
const mapped = {
isAuthorized: isAuthenticated(state),
user: state.authentication.user,
};
return mapState ? mapState(mapped, state, props) : mapped;
};
return connect(mapStateToProps);
};