Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async handleSubmit(event) {
- let userLoginObject = {
- login: this.state.username,
- password: this.state.password,
- }
- if (!isEmptyOrNull(this.state.username) &&
- !isEmptyOrNull(this.state.password)) {
- let resp = await this.props.onUserLogin(userLoginObject)
- console.log("resp",resp) // this shows 'undefined'
- this.setState({ formError: resp }); //Im trying to set state to the formError
- }
- }
- export const onUserLogin = (userLoginData) => async (dispatch) => {
- const loginResponse = await doUserLogin(userLoginData)
- dispatch({
- type: ACTION_LOGIN,
- data: loginResponse,
- })
- if (loginResponse.token) {
- history.push('/investments')
- }
- else {
- console.log("error",loginResponse.error) // this shows the error message
- return loginResponse
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement