1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-24 22:35:49 -04:00
Files
Radarr/src/UI/Mixins/jquery.ajax.js
T
2014-01-24 14:08:05 -08:00

34 lines
749 B
JavaScript

//try to add ajax data as query string to DELETE calls.
'use strict';
define(
[
'jquery'
], function ($) {
var original = $.ajax;
$.ajax = function (xhr) {
if (xhr && xhr.data && xhr.type === 'DELETE') {
if (xhr.url.contains('?')) {
xhr.url += '&';
}
else {
xhr.url += '?';
}
xhr.url += $.param(xhr.data);
delete xhr.data;
}
if (xhr) {
xhr.headers = xhr.headers || {};
xhr.headers['X-Api-Key'] = window.NzbDrone.ApiKey;
}
return original.apply(this, arguments);
};
});