Advertisement
Guest User

Untitled

a guest
Sep 20th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. /**
  2. * Created by Bartlomiej Rutkowski on 18.09.16.
  3. */
  4. import React from 'react';
  5. import {connect} from 'react-redux';
  6. import {LoginPage} from '../components/LoginPage';
  7. import {authenticateUser} from '../UserActions';
  8.  
  9. export class LoginPageContainer extends React.Component {
  10. constructor() {
  11. super();
  12. this.state = {
  13. username: '',
  14. password: ''
  15. };
  16. }
  17.  
  18. handleChange = (field, event) => {
  19. this.setState({
  20. [field]: event.target.value
  21. });
  22. };
  23.  
  24. render() {
  25. const functions = {
  26. handleChange: this.handleChange,
  27. authenticateUser: this.props.authenticateUser.bind(this, this.state)
  28. };
  29. return (
  30. <div>
  31. <LoginPage
  32. state={this.state}
  33. functions={functions}
  34. />
  35. </div>
  36. );
  37. }
  38. }
  39.  
  40. LoginPageContainer.propTypes = {
  41. authenticateUser: React.PropTypes.func
  42. };
  43.  
  44. function mapStateToProps() {
  45. return {
  46.  
  47. };
  48. }
  49.  
  50. function mapDispatchToProps(dispatch) {
  51. return {
  52. authenticateUser: user => dispatch(authenticateUser(user))
  53. };
  54. }
  55.  
  56. export default connect(mapStateToProps, mapDispatchToProps)(LoginPageContainer);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement