Is there a way to add a method that will always be called when success or error? Like Exceptions have finalize.
I want to stop the button loading spinner in any case.
Yes, you can use finally(callback)
How?
Heres an example:
new Vue({
ready: function() {
// GET request
this.$http({url: '/someUrl', method: 'GET'}).then(function (response) {
// success callback
}, function (response) {
// error callback
}).finally(function () {
// finally callback
});
}
})
Thanks
I want to have response object in finally callback. I am getting undefined
Most helpful comment
Heres an example: