Untitled

 avatar
unknown
javascript
2 years ago
265 B
8
Indexable
// In a Vue method
async fetchBitcoinPrice() {
  const response = await this.callBitcoinAPI();
  this.bitcoinPrice = response.data.bitcoin.usd;
},
// A separated method for the API call keeps things neat
async callBitcoinAPI() {
  return axios.get('<API_URL>');
},
Editor is loading...