The code I was attempting was this;
axios({
method:'get',
url:'/user',
baseURL:'https://api.github.com',
auth:{
username:'username',
password:'password'
}
}).then((response)=>{
this.errorMessage='';
console.log(response);
}).catch(function(error){
this.errorMessage='Authentication failed';
})
But I keep getting the error "Uncaught (in promise) TypeError: Cannot set property 'errorMessage' of undefined"
Now the usual suspect is already solved; 'errorMessage' was declared on Data and given the value of '', so it's not that. And the 'this.errorMessage' on the response part of things works (I tested it to say 'auth successful'), it just doesn't work on the catch error part of things.