Created
July 14, 2016 05:32
-
-
Save kazagkazag/e1f150d29075713ce02ca9bcb6c30fd5 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 {connect} from "react-redux"; | |
import * as actions from "./actions"; | |
import LoginForm from "./components/LoginForm"; | |
*/ | |
export class Login extends Component { | |
render() { | |
return ( | |
<LoginForm | |
onLogin={this.props.authenticate} | |
isAuthenticated={this.props.isAuthenticated} | |
/> | |
); | |
} | |
} | |
export const mapStateToProps = (state) => { | |
return { | |
isAuthenticated: state.authentication.isAuthenticated | |
} | |
}; | |
export const mapDispatchToProps = (dispatch) => { | |
return { | |
authenticate: () => { | |
dispatch(actions.authenticate()) | |
} | |
} | |
}; | |
Login.propTypes = { | |
authenticate: PropTypes.func, | |
isAuthenticated: PropTypes.bool.isRequired | |
}; | |
export default connect( | |
mapStateToProps, | |
mapDispatchToProps | |
)(Login); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment