What's the best way to retry failed AJAX request in VueJS ?
bulkDecline(requests, decliner) {
requests = _.map(requests, 'id');
return Vue.http.post(`${baseUrl}/api/decline/${decliner}/bulk-decline`, requests)
.then(
(response) => {
Notification({
title: 'Success!',
message: response.data.message,
type: 'success'
});
return response;
},
(response) => {
this.bulkDecline(requests, decliner);
}
);
}
But it seems like its not working.
Are you doing this within a single-file component?
If so, have you tried using
instead of
Vue.http.post
?You may also have some luck if you send through your
requests
in an object like{ data: requests }
or similar.