mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-23 22:45:06 -04:00
New: Project Aphrodite
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import $ from 'jquery';
|
||||
import { set } from '../baseActions';
|
||||
|
||||
function createFetchSchemaHandler(section, url) {
|
||||
return function(getState, payload, dispatch) {
|
||||
dispatch(set({ section, isSchemaFetching: true }));
|
||||
|
||||
const promise = $.ajax({
|
||||
url
|
||||
});
|
||||
|
||||
promise.done((data) => {
|
||||
dispatch(set({
|
||||
section,
|
||||
isSchemaFetching: false,
|
||||
isSchemaPopulated: true,
|
||||
schemaError: null,
|
||||
schema: data
|
||||
}));
|
||||
});
|
||||
|
||||
promise.fail((xhr) => {
|
||||
dispatch(set({
|
||||
section,
|
||||
isSchemaFetching: false,
|
||||
isSchemaPopulated: true,
|
||||
schemaError: xhr
|
||||
}));
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export default createFetchSchemaHandler;
|
||||
Reference in New Issue
Block a user