carlarenee / message_from_mars

0 stars 0 forks source link

Passing Username from login to retrieving db user info #2

Closed carlarenee closed 7 years ago

carlarenee commented 7 years ago

Hi! We're having trouble with trying to pass a username to our get saved images from DB. We're trying to have the login button pass username and we can't seem to get it working. We've been stuck on it for a while. Thanks for any help!

Here are some of the code snippets from this morning's attempt:

App.jsx login functions:

loginFunctions(username) {
  console.log('trying to get our saved searches for', username);
  getSavedImages(username);
  handleFormSubmit();
}

App.jsx render and handle login

<LogInForm
                loginFunctions={this.loginFunctions.bind(this)}
                className={this.state.login.loggedIn ? 'hidden' : ''}
                logInUsername={this.state.login.username}
                logInPassword={this.state.login.password}
                updateFormUsername={event => this.updateFormLogInUsername(event)}
                updateFormPassword={event => this.updateFormLogInPassword(event)}
                handleFormSubmit={() => this.handleLogIn()}
                getSavedImages{() => this.getSavedImages()}
              />

LoginForm.jsx:

    return (
      <div id='form-container'>
        <input
          type="text"
          placeholder="email"
          value={this.props.logInUsername}
          onChange={this.props.updateFormUsername}
        />
        <input
          type="password"
          placeholder="password"
          value={this.props.logInPassword}
          onChange={this.props.updateFormPassword}
        />
        <button onClick={this.props.loginFunctions(this.props.logInUsername)}>
          Log In!
        </button>
      </div>
    );
  }

Bobby - @gittheking Jason - @jasonseminara Trevor - @trevorpreston Rafa - @rapala61 Irwin - @irwintsay

gittheking commented 7 years ago

@carlarenee is there an error that is being thrown? what are your seeing when you try to login? Are you getting the username in loginFunctions()?