SHARE
TWEET

Untitled

a guest Jun 18th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. async  handleSubmit(event) {
  2.     let userLoginObject = {
  3.       login: this.state.username,
  4.       password: this.state.password,
  5.     }
  6.     if (!isEmptyOrNull(this.state.username) &&
  7.       !isEmptyOrNull(this.state.password)) {
  8.       let resp = await this.props.onUserLogin(userLoginObject)
  9.       console.log("resp",resp) // this shows 'undefined'
  10.       this.setState({ formError: resp }); //Im trying to set state to the formError
  11.     }
  12. }
  13.      
  14. export const onUserLogin = (userLoginData) => async (dispatch) => {
  15.   const loginResponse = await doUserLogin(userLoginData)
  16.   dispatch({
  17.     type: ACTION_LOGIN,
  18.     data: loginResponse,
  19.   })
  20.   if (loginResponse.token) {
  21.       history.push('/investments')
  22.   }
  23.   else {
  24.     console.log("error",loginResponse.error) // this shows the error message
  25.     return loginResponse
  26.   }
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top