After successfully logging in (with a status of 200), I want to change my route to /expenses.
async SendLogin() {
const response = await axios.post("api/auth/login", {
email: this.email,
password: this.password,
});
localStorage.setItem("token", response.data.token);
const status = JSON.parse(response.data.response.status);
if (status == "200") {
this.$router.push("/expenses");
} else {
showError(true), setTimeout(showError(false), 3000);
}
},
When I log in and inspect in my browser, I receive the following message:
{data: {...}, status: 200, statusText: "OK", headers: {...}, config: {...}, ...}
[Vue warn]: Error in v-on handler (Promise/async): "TypeError: Cannot read property 'status' of undefined"