[Vuejs]-POST request to djoser auth

-1👍

I suppose that in this you have no vue instance, but axios.

Define before axios let vue = this;, somethink like this:

logIn: () => {
  let vue = this;

  axios
    .post("http://127.0.0.1:8000/auth/token/login/", {
      email: "test2@test.com",
      password: "password"
    })
    .then(response => {
      vue.authtoken = response.authtoken;
    })
    .catch(error => {
      vue.error = error;
    });
}

Leave a comment