login() {
    const url = this.server + '/api2/auth-token/';
    return axios.post(url, {
      username: this.username,
      password: this.password
    })
      .then((response) => {
        this.token = response.data.token;
        this.req = axios.create({
          baseURL: this.server,
          headers: { 'Authorization': 'Token ' + this.token }
        });
      })
      .catch(function (error) {
        console.log(error);
      });
  }
/**
  * Login to server and create axios instance for future usage
  */
Login to server and create axios instance for future usage
Login to server and create axios instance for future usage
login() {
    const url = this.server + '/api2/auth-token/';
    return axios.post(url, {
      username: this.username,
      password: this.password
    })
      .then((response) => {
        this.token = response.data.token;
        this.req = axios.create({
          baseURL: this.server,
          headers: { 'Authorization': 'Token ' + this.token }
        });
      })
      .catch(function (error) {
        console.log(error);
      });
  }
login ( ) { const url = this . server + '/api2/auth-token/' ; return axios . post ( url , { username : this . username , password : this . password } ) . then ( ( response ) => { this . token = response . data . token ; this . req = axios . create ( { baseURL : this . server , headers : { 'Authorization' : 'Token ' + this . token } } ) ; } ) . catch ( function ( error ) { console . log ( error ) ; } ) ; }
Login to server and create axios instance for future usage
Login to server and create axios instance for future usage