<commit_before>import React, {Component, PropTypes} from 'react';
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';

import * as AuthenticationAction from '../../actions/authentication';

class HomeView extends Component {

  constructor(props) {
    super(props);
    this.state = {ready: false};
  }

  componentWillMount() {
    this.props.authenticationActions.doLogin()
      .then(_ => this.setState({ready: true}));
  }

  render() {
    if (!this.state.ready) return (<div></div>);
    return (<div>Hello World</div>);
  }

}

HomeView.propTypes = {
  authentication: PropTypes.shape({
    id: PropTypes.string
  }),
  authenticationActions: PropTypes.shape({
    doLogin: PropTypes.func.isRequired
  }).isRequired,
};

function mapStateToProps(state) {
  return {
    authentication: state.authentication,
  }
}

function mapDispatchToProps(dispatch) {
  return {
    authenticationActions: bindActionCreators(AuthenticationAction, dispatch),
  }
}

export default connect(
  mapStateToProps,
  mapDispatchToProps
)(HomeView);
<commit_msg>Added logout functionality<commit_after>import React, {Component, PropTypes} from 'react';
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import RaisedButton from 'material-ui/RaisedButton';

import * as AuthenticationAction from '../../actions/authentication';

class HomeView extends Component {

  constructor(props) {
    super(props);
    this.state = {ready: false};
  }

  componentWillMount() {
    this.props.authenticationActions.doLogin()
      .then((resp) => {
        this.setState({ready: true, authentication: resp.payload})
      });
  }

  doLogout() {
    this.props.authenticationActions.doLogout(this.state.authentication.userId)
  }

  render() {
    if (!this.state.ready) return (<div></div>);
    return (
      <div>
        <div>Hello World</div>
        <RaisedButton label="Logout" onTouchTap={this.doLogout.bind(this)} secondary={true}/>
      </div>
    );
  }

}

HomeView.propTypes = {
  authentication: PropTypes.shape({
    id: PropTypes.string
  }),
  authenticationActions: PropTypes.shape({
    doLogin: PropTypes.func.isRequired,
    doLogout: PropTypes.func.isRequired
  }).isRequired,
};

function mapStateToProps(state) {
  return {
    authentication: state.authentication,
  }
}

function mapDispatchToProps(dispatch) {
  return {
    authenticationActions: bindActionCreators(AuthenticationAction, dispatch),
  }
}

export default connect(
  mapStateToProps,
  mapDispatchToProps
)(HomeView);

{'fraction_non_alphanumeric': 0.13231252453867295, 'fraction_numerical': 0.0, 'mean_word_length': 4.0858283433133735, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2369705', 'n_tokens_mistral': 771, 'n_tokens_neox': 781, 'n_words': 154}