mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-20 21:54:25 -04:00
Fix GitIgnore, Update from Sonarr
This commit is contained in:
@@ -1,7 +1,18 @@
|
||||
import $ from 'jquery';
|
||||
import createAjaxRequest from 'Utilities/createAjaxRequest';
|
||||
import getProviderState from 'Utilities/State/getProviderState';
|
||||
import { set } from '../baseActions';
|
||||
|
||||
const abortCurrentRequests = {};
|
||||
|
||||
export function createCancelTestProviderHandler(section) {
|
||||
return function(payload) {
|
||||
if (abortCurrentRequests[section]) {
|
||||
abortCurrentRequests[section]();
|
||||
abortCurrentRequests[section] = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function createTestProviderHandler(section, url, getFromState) {
|
||||
return function(payload) {
|
||||
return function(dispatch, getState) {
|
||||
@@ -17,9 +28,11 @@ function createTestProviderHandler(section, url, getFromState) {
|
||||
data: JSON.stringify(testData)
|
||||
};
|
||||
|
||||
const promise = $.ajax(ajaxOptions);
|
||||
const { request, abortRequest } = createAjaxRequest()(ajaxOptions);
|
||||
|
||||
promise.done((data) => {
|
||||
abortCurrentRequests[section] = abortRequest;
|
||||
|
||||
request.done((data) => {
|
||||
dispatch(set({
|
||||
section,
|
||||
isTesting: false,
|
||||
@@ -27,11 +40,11 @@ function createTestProviderHandler(section, url, getFromState) {
|
||||
}));
|
||||
});
|
||||
|
||||
promise.fail((xhr) => {
|
||||
request.fail((xhr) => {
|
||||
dispatch(set({
|
||||
section,
|
||||
isTesting: false,
|
||||
saveError: xhr
|
||||
saveError: xhr.aborted ? null : xhr
|
||||
}));
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user