Initial Commit Rework

This commit is contained in:
Qstick
2017-09-03 22:20:56 -04:00
parent 74a4cc048c
commit 95051cbd63
2483 changed files with 101351 additions and 111396 deletions
@@ -0,0 +1,41 @@
import $ from 'jquery';
import getProviderState from 'Utilities/State/getProviderState';
import { set } from '../baseActions';
function createTestProviderHandler(section, url, getFromState) {
return function(payload) {
return function(dispatch, getState) {
dispatch(set({ section, isTesting: true }));
const testData = getProviderState(payload, getState, getFromState);
const ajaxOptions = {
url: `${url}/test`,
method: 'POST',
contentType: 'application/json',
dataType: 'json',
data: JSON.stringify(testData)
};
const promise = $.ajax(ajaxOptions);
promise.done((data) => {
dispatch(set({
section,
isTesting: false,
saveError: null
}));
});
promise.fail((xhr) => {
dispatch(set({
section,
isTesting: false,
saveError: xhr
}));
});
};
};
}
export default createTestProviderHandler;