score:2

Accepted answer
    onSubmit(values) {
    this.props
      .signIn(values)
      .then((response) => {
        swal("Login successful", "Signed In", "success");
          this.props.history.push(`/dashboard/${response.data.user_name}`);
      })
      .catch((error) => {
        console.log("ajax error");
        swal({
          title: "Invalid Email Id or password",
          icon: "warning",
        });
      });
  }

score:0

export function signIn(values, callback) {
    const request = axios.post(`${ROOT_URL}/${APP_ID}/${API_KEY}/users/login`, values).then((response) => callback(response)).catch((error) => callback(error));

    return {
        type: LOGIN_DETAILS,
        payload: request
    };
}

Related Query

More Query from same tag