0
Try this code.
mounted () {
this.isMounted = true;
axios
.get('https://api.coindesk.com/v1/bpi/currentprice.json')
.then(response => {
console.log("Response is" + response)
})
.catch(error => {
console.log(error)
})
}
or
mounted () {
axios.get('https://api.coindesk.com/v1/bpi/currentprice.json')
.then(function (response) {
console.log("Response is" + response)
}.bind(this))
.catch(error => {
console.log(error)
})
}
0
I have found the error.
I had activated a mock adpter so every call was handled by this MockAdapter.
var mock = new MockAdapter(axios);
So every call fails if it is not in the mockCalls list.
Is there any way to have a MockAdapter for only some specific calls? For example you have to use two different API and only want to have mocked one of them
Source:stackexchange.com