S
S
sergmit2018-12-13 11:21:52
React
sergmit, 2018-12-13 11:21:52

Why is axios throwing an error?

Why is axios throwing an error:

function getUser() {
     return (dispatch) => {
          axios.get('/login').then(data => {
              dispatch({type: LOGIN, payload: data.data.login});
              dispatch({type: name, payload: data.data.name});
          });
         .catch(e => console.log(e));
     }
}

The request passes, the first dispatch fires and then throws an error (catch fires)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2018-12-13
@sergmit

Povangyu: the variable nameis not defined.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question