Running the following code:
import axios from 'axios';
import config from '../config';
const login = code => ({
  type: 'SESSION',
  payload: new Promise((resolve, reject) => {
    return axios({
      method: 'post',
      responseType: 'json',
      url: `${config.api.url}/auth`,
      data: {
        code
      }
    })
    .then((response) => {
      console.log('success');
      return resolve(response.data);
    })
    .catch((error) => {
      console.log('error', error.response.data);
      return reject(error.response.data); // something going wrong here
    });
  })
});
export {
  login
};
Causes the following error:
Uncaught (in promise) {status: 500, error: "Something went wrong on the server.", type: "internalServerError"}
The status 500 is on purpose, to debug my error handling. However, there is a problem with rejecting the error.
The Promise looks valid to me. Am I missing something here?
