Fix GitIgnore, Update from Sonarr

This commit is contained in:
Qstick
2017-09-10 21:20:36 -04:00
parent 77f1d2e64c
commit 22d9c5e666
17 changed files with 603 additions and 51 deletions
@@ -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
}));
});
};