[Vuejs]-Axios call to Springboot backend responding is not forwarding to new page after returning response

0👍

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.

axios.post("http://localhost:8080/api/v1/login", formData,
        {headers: {'Content-Type': 'application/json'}})
        .then(function (res) {
          if (res.status === 200) {
            this.router.push('/dashboard')
            console.log("success");
          } else {
            console.log(res.status);
          }
        })
        .catch(function (err) {
          console.log(err);
        })

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.

Leave a comment