Skip to content
Advertisement

Axios call to Springboot backend responding is not forwarding to new page after returning response

My postmapping “login” in my controller is returning a 200. But I’m getting undefined and I believe it is from my axios call. I know that the undefined error is being reported from the catch block in the console

Axios call –

JavaScript

Response from dev tools

Response from test

Advertisement

Answer

Axios response schema documentation is here

Unless you have a key code in your controller response, response.data.code will be undefined.

Try res.status instead if you want to check the HTTP status.

JavaScript

EDIT You seem to be sending back the password back in the response. Even though the password is encrypted, better restrict exposing it in the response.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement