mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-23 22:25:09 -04:00
Fix GitIgnore, Update from Sonarr
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import $ from 'jquery';
|
||||
|
||||
export default function createAjaxRequest() {
|
||||
return function(ajaxOptions) {
|
||||
const requestXHR = new window.XMLHttpRequest();
|
||||
let aborted = false;
|
||||
let complete = false;
|
||||
|
||||
function abortRequest() {
|
||||
if (!complete) {
|
||||
aborted = true;
|
||||
requestXHR.abort();
|
||||
}
|
||||
}
|
||||
|
||||
const request = $.ajax({
|
||||
xhr: () => requestXHR,
|
||||
...ajaxOptions
|
||||
}).then(null, (xhr, textStatus, errorThrown) => {
|
||||
xhr.aborted = aborted;
|
||||
|
||||
return $.Deferred().reject(xhr, textStatus, errorThrown).promise();
|
||||
})
|
||||
.always(() => {
|
||||
complete = true;
|
||||
});
|
||||
|
||||
return {
|
||||
request,
|
||||
abortRequest
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user