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_r174216165
##########
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:
Ok that makes sense.
----------------------------------------------------------------
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