You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
895 B
35 lines
895 B
12 years ago
|
//try to add ajax data as query string to DELETE calls.
|
||
12 years ago
|
'use strict';
|
||
12 years ago
|
define(function () {
|
||
12 years ago
|
|
||
12 years ago
|
return function () {
|
||
12 years ago
|
|
||
12 years ago
|
var original = this.ajax;
|
||
|
this.ajax = function () {
|
||
12 years ago
|
|
||
12 years ago
|
var xhr = arguments[0];
|
||
12 years ago
|
|
||
12 years ago
|
//check if ajax call was made with data option
|
||
|
if (xhr && xhr.data && xhr.type === 'DELETE') {
|
||
11 years ago
|
if (!xhr.url.contains('?')) {
|
||
12 years ago
|
xhr.url = xhr.url + '?' + $.param(xhr.data);
|
||
|
}
|
||
|
else {
|
||
|
xhr.url = xhr.url + '&' + $.param(xhr.data);
|
||
|
}
|
||
11 years ago
|
|
||
|
delete xhr.data;
|
||
12 years ago
|
}
|
||
11 years ago
|
if (xhr) {
|
||
|
if (!xhr.headers) {
|
||
|
xhr.headers = {};
|
||
|
}
|
||
|
|
||
|
xhr.headers["ApiKey"] = window.NzbDrone.ApiKey;
|
||
|
}
|
||
12 years ago
|
|
||
12 years ago
|
return original.apply(this, arguments);
|
||
|
};
|
||
12 years ago
|
};
|
||
12 years ago
|
});
|