<commit_before>/** @jsx React.DOM */
var Login = React.createClass({
  
  mixins: [Backbone.Events],

  getInitialState: function() {
    return new UserModel(); 
  },

  //Set listener on state (which is a backbone model)
  componentDidMount: function(){
    this.listenTo(this.state, 'change', function(){
      console.log('heard a change event!');
    }, this);
  },

  //Every time a user interacts with the form, we need to update the state of the view to reflect that change.
  handleChange: function(event) {
    if(event.target.name === 'email'){
      this.state.set('email', event.target.value);
    } else {
      this.state.set('password', event.target.value);
    };
  },

  //Send the state to a backbone model to be sent to Yummly
  handleSubmit: function(e){
    e.preventDefault();
    var that = this;
    
    //Send a POST request to the server with the QueryModel to get a list of recipes that match the query.
    this.state.fetch({}, {
      success: function(model, res){
        console.log("Response from the server: ", res);

        
      },
      error: function(model, err){
        console.error("There was an error with your request! ", err);
      }
    }); 
  },

  render: function() {
    return (
      <form name="login" onSubmit={this.handleSubmit}>
        <ul>
          <li><label for="email">Email</label>
          <input type="email" name="email" placeholder="<EMAIL>" required /></li>
          <li><label for="password">Password</label>
          <input type="password" name="password" placeholder="password" required /></li>
          <li>
          <input type="submit" value="Login" /></li>
        </ul>
      </form>
    );
  }
});<commit_msg>pull in shopping list view and set up temporary fake login success to allow mealQuery view render<commit_after>/** @jsx React.DOM */
var Login = React.createClass({
  
  mixins: [Backbone.Events],

  getInitialState: function() {
    return new UserModel(); 
  },

  //Set listener on state (which is a backbone model)
  componentDidMount: function(){
    this.listenTo(this.state, 'change', function(){
      console.log('heard a change event!');
    }, this);
  },

  //Every time a user interacts with the form, we need to update the state of the view to reflect that change.
  handleChange: function(event) {
    if(event.target.name === 'email'){
      this.state.set('email', event.target.value);
    } else {
      this.state.set('password', event.target.value);
    };
  },

  //Send the state to a backbone model to be sent to Yummly
  handleSubmit: function(e){
    e.preventDefault();
    var that = this;

    //TODO: This is a temporary call to load the next view without actually logging in. Make sure to fix it and place it inside of the save method.
    that.props.onSubmit();

    // //Send a POST request to the server with the QueryModel to get a list of recipes that match the query.
    // this.state.fetch({}, {
    //   //TODO: set up response handling for rendering the next view after successful login or failed login.
    //   success: function(model, res){
    //     console.log("Response from the server: ", res);
        
    //   },
    //   error: function(model, err){
    //     console.error("There was an error with your request! ", err);
    //   }
    // }); 
  },

  render: function() {
    return (
      <form name="login" onSubmit={this.handleSubmit}>
        <ul>
          <li><label for="email">Email</label>
          <input type="email" name="email" placeholder="<EMAIL>" required /></li>
          <li><label for="password">Password</label>
          <input type="password" name="password" placeholder="password" required /></li>
          <li>
          <input type="submit" value="Login" /></li>
        </ul>
      </form>
    );
  }
});
{'fraction_non_alphanumeric': 0.14263074484944532, 'fraction_numerical': 0.0, 'mean_word_length': 2.610104861773117, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, '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': '4295264', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1078, 'n_words': 361}