Created
April 16, 2019 09:45
-
-
Save kaleem-elahi/2314b2fd68c210d1673cd7bf70ba3e33 to your computer and use it in GitHub Desktop.
Manage multi-tenant by using this file - RenderByTenant. Multitenant + role-based
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { | |
| Component, | |
| } from 'react'; | |
| import PropTypes from 'prop-types'; | |
| import { | |
| connect, | |
| } from 'react-redux'; | |
| class RenderByTenant extends Component { | |
| render() { | |
| const { | |
| roles, | |
| tenants, | |
| } = this.props.accountInfo; | |
| return tenants[0].name === 'WP' ? this.props.WP(roles) : this.props.ERG(roles); | |
| } | |
| } | |
| RenderByTenant.propTypes = { | |
| // roles: PropTypes.arrayOf(PropTypes.object) | |
| // .isRequired, | |
| accountInfo: PropTypes.objectOf(PropTypes.object) | |
| .isRequired, | |
| WP: PropTypes.func.isRequired, | |
| ERG: PropTypes.func.isRequired, | |
| }; | |
| const mapStateToProps = state => ({ | |
| accountInfo: state.recruiter.accountInfo, | |
| }); | |
| export default connect(mapStateToProps)(RenderByTenant); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment