Skip to content

Instantly share code, notes, and snippets.

@nickstenning
Created May 26, 2018 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickstenning/ac654763684c1b26f172e83076a5f9e2 to your computer and use it in GitHub Desktop.
Save nickstenning/ac654763684c1b26f172e83076a5f9e2 to your computer and use it in GitHub Desktop.
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