1

I am developing react-redux application where i am calling action by using the dispatch but its not working. I am using redux-thunk also.

Component code is below

class UpdateProfileForm extends Component {
  constructor(props){
    super(props);
  }

  componentDidMount(){
      const userInfo = this.props.dispatch(getUserInfo);
  }
}

Below is the action file

export function getUserInfo() {

    return (dispatch) => {

      return new Promise((resolve, reject) => {
          console.log("hiii");
        let url = `${SERVER_URL}api/v1/user/getUserInfo`;
        axios.defaults.headers.common['X-JWT'] = sessionStorage.token;
        axios.post(url)
        .then(function (response) {
          resolve(response);
        })
        .catch(function (error) {
            reject(error);
        });
      })
    }
}

If i add console.log before return(dispatch) then control will come, but control will not go inside this callback, Please let me know... i am missing something here?

Lionel Dcosta
  • 138
  • 2
  • 13

0 Answers0