I have this code in my ready method:
this.$http.get('url',{},{
headers: {
"X-App-Token": "token"
}
}).then( (data) => this.$set('cdata',data.data))
.catch( (error) => console.log('Got a problem'+error));
and its working well, the probelm is when i move this to a another functtion in methods object it doesn't work.
ready(){
this.getJsonData();
},
methods: {
getJsonData: () => {
this.$http.get('url',{},{
headers: {
"X-App-Token": "token"
}
}).then( (data) => this.$set('cdata',data.data))
.catch( (error) => console.log('Got a problem'+error));
},
},
The error:
src\src\App.vue:23 Uncaught TypeError: Cannot read property '$http' of undefined
//this becomes undefined.