[Vuejs]-Vuejs error after passing axios interceptor

0👍

I finally found a solution but very dirty, which I find repetitive for not much.

It’s on each call axios, to put a condition that checks if "err" exists…

I would have preferred to be able to interact on the interceptor to have managed this in only one place.

If someone has a better solution, I’ll take it !

deleteApi(id) {
            this.$store.dispatch('deleteApi', id)
                .then((res) => {
                    this.$toast.success(res.data.success)
                    this.deleteApiModal(id)
                })
                .catch(err => { if(err) this.$toast.error(err.api[0]) })
        },

Leave a comment