[Vuejs]-Uncaught TypeError: axios__WEBPACK_IMPORTED_MODULE_1__.default.get(…).then(…).error is not a function

0👍

The error you’re encountering is due to a typo in your code. The correct function to handle errors in axios is .catch() rather than .error().
Example:

axios.get(`http://localhost:6969/sendmail/${this.dt.userEmail}`)
.then((response)=>console.log(response))
.catch((error)=>console.log(error));

If you are wondering why it is working despite the error, it’s because your request goes through and you receive a successful response, which leads you to the .then() statement, yet you still get the error.

Leave a comment