Currently, I am working on setting up a register feature with a specific endpoint. The challenge I am facing revolves around handling validation responses from the backend. For instance, if I attempt to register with a username that is less than six characters, the backend sends a response indicating that the username should exceed six characters.
Although the backend response is visible within the network tab and in Postman, I encounter an error when trying to log the response using console.log(response)
. The error message reads as follows:
referenceError: response is not defined
.
Here is a snippet of my code:
axios.post(url, payload,{
})
.then( response => {
console.log('response')
console.log(response)
} )
https://i.sstatic.net/6QMNs.png