garrensmith commented on a change in pull request #1065: Remove JQuery uses
from documents addon
URL: https://github.com/apache/couchdb-fauxton/pull/1065#discussion_r174040829
##########
File path: app/addons/documents/resources.js
##########
@@ -120,31 +118,26 @@ Documents.BulkDeleteDocCollection =
FauxtonAPI.Collection.extend({
},
bulkDelete: function () {
- var payload = this.createPayload(this.toJSON()),
- promise = FauxtonAPI.Deferred(),
- that = this;
-
- $.ajax({
- type: 'POST',
- url: this.url(),
- contentType: 'application/json',
- dataType: 'json',
- data: JSON.stringify(payload),
- }).then(function (res) {
- that.handleResponse(res, promise);
- }).fail(function () {
- var ids = _.reduce(that.toArray(), function (acc, doc) {
- acc.push(doc.id);
- return acc;
- }, []);
- that.trigger('error', ids);
- promise.reject(ids);
+ const payload = this.createPayload(this.toJSON());
+ const promise = new FauxtonAPI.Promise((resolve, reject) => {
+ post(this.url(), payload).then(res => {
+ if (res.error) {
Review comment:
Do you think throwing our own error is the best way of handling this? Could
we not just handle it here where we know the error has happened?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services