vue axios catch error

Solutions on MaxInterview for vue axios catch error by the best coders in the world

showing results for - "vue axios catch error"
Damien
04 Feb 2020
1axios.get('/user/1').then((response) => {
2    console.log('Everything is awesome.');
3}).catch((error) => {
4    console.warn('Not good man :(');
5})
Vincenzo
26 Jan 2020
1new Vue({
2  el: '#app',
3  data () {
4    return {
5      info: null,
6      loading: true,
7      errored: false
8    }
9  },
10  filters: {
11    currencydecimal (value) {
12      return value.toFixed(2)
13    }
14  },
15  mounted () {
16    axios
17      .get('https://api.coindesk.com/v1/bpi/currentprice.json')
18      .then(response => {
19        this.info = response.data.bpi
20      })
21      .catch(error => {
22        console.log(error)
23        this.errored = true
24      })
25      .finally(() => this.loading = false)
26  }
27})