Created
May 26, 2018 19:11
-
-
Save nickstenning/ac654763684c1b26f172e83076a5f9e2 to your computer and use it in GitHub Desktop.
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 React from "react"; | |
import PropTypes from "prop-types"; | |
import { compose } from "redux"; | |
import { connect } from "react-redux"; | |
import { isEmpty, populate, withFirebase } from "react-redux-firebase"; | |
import AppDrawerAuth from "./AppDrawerAuth"; | |
class AppDrawerAuthContainer extends React.Component { | |
render() { | |
const { profile, signOut } = this.props; | |
if (isEmpty(profile)) { | |
return null; | |
} | |
console.log(profile); | |
return <AppDrawerAuth profile={profile} signOut={signOut} /> | |
} | |
} | |
AppDrawerAuthContainer.propTypes = { | |
profile: PropTypes.object.isRequired, | |
signOut: PropTypes.func.isRequired, | |
}; | |
const populates = [{child: 'organisation', root: 'organisations'}]; | |
const mapStateToProps = ({firebase}) => ({ | |
profile: populate(firebase, 'profile', populates), | |
signOut: () => { console.log('signOut') }, | |
}); | |
export default compose( | |
withFirebase, | |
connect(mapStateToProps), | |
)(AppDrawerAuthContainer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment