Skip to content
Discussion options

You must be logged in to vote

you are not returning the Promise from the mutationFn:

    () => {
      axios
        .post("https://gorest.co.in/public/v2/users", postObj, {
          headers: headers
        })
        .then((resp) => {
          console.log("response: ", resp);
        })
        .catch((err) => {
          console.log(" post errr", err);
        });
    },

it must be return axios.post(...)

working fork

Also, another thing I noticed: If you .catch(error) and just log it, you will transform errors into resolved promises, so you can never get to error state.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@reinisg
Comment options

Answer selected by reinisg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants