Skip to content

Undefinend response with axios

github logo ・1 min read  

Hi I have a question about the following code, this code makes a rest call with axios to a server, the value returns correctly from the node.js server, that is, if I test the call with postman I have a response with the integer value however in this case the value is undefined what is it due to?'/utente/login', payload,header).then(function (response) {

 console.log("\n Valore di"; //Undefinend?

twitter logo DISCUSS (2)
markdown guide

Are you sure that the response object has a property named data? Try logging the whole response and see what you get.


By default axios response have a data property where all response are stored. Unless things have changed from the last time I used it. As you said, the whole response object should be logged to see its content.

Classic DEV Post from Jun 1 '19

What the heck is a Developer Advocate?

TL;DR: A developer advocate is a developer’s best friend! For the past three years or so, I have bee...

rikidev profile image

Do you prefer sans serif over serif?

You can change your font preferences in the "misc" section of your settings. ❤️