popojargo commented on a change in pull request #1062: Remove JQuery usage from
config addon
URL: https://github.com/apache/couchdb-fauxton/pull/1062#discussion_r173639373
##########
File path: app/addons/config/resources.js
##########
@@ -30,20 +31,20 @@ Config.OptionModel = Backbone.Model.extend({
isNew () { return false; },
sync (method, model) {
-
- var params = {
- url: model.url(),
- contentType: 'application/json',
- dataType: 'json',
- data: JSON.stringify(model.get('value'))
- };
-
+ let operation = put;
if (method === 'delete') {
- params.type = 'DELETE';
- } else {
- params.type = 'PUT';
+ operation = deleteRequest;
}
- return $.ajax(params);
+
+ return operation(
+ model.url(),
+ model.get('value')
Review comment:
Passing the value for the deleteRequest might have side effects.
deleteRequest take the second parameter as options (not body)
----------------------------------------------------------------
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