mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
Initial Commit Rework
This commit is contained in:
parent
74a4cc048c
commit
95051cbd63
2483 changed files with 101351 additions and 111396 deletions
|
@ -0,0 +1,48 @@
|
|||
import $ from 'jquery';
|
||||
import { batchActions } from 'redux-batched-actions';
|
||||
import * as types from './actionTypes';
|
||||
import { set, update } from './baseActions';
|
||||
|
||||
const section = 'interactiveImport';
|
||||
|
||||
const interactiveImportActionHandlers = {
|
||||
[types.FETCH_INTERACTIVE_IMPORT_ITEMS]: function(payload) {
|
||||
return function(dispatch, getState) {
|
||||
if (!payload.downloadId && !payload.folder) {
|
||||
dispatch(set({ section, error: { message: '`downloadId` or `folder` is required.' } }));
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch(set({ section, isFetching: true }));
|
||||
|
||||
const promise = $.ajax({
|
||||
url: '/manualimport',
|
||||
data: payload
|
||||
});
|
||||
|
||||
promise.done((data) => {
|
||||
dispatch(batchActions([
|
||||
update({ section, data }),
|
||||
|
||||
set({
|
||||
section,
|
||||
isFetching: false,
|
||||
isPopulated: true,
|
||||
error: null
|
||||
})
|
||||
]));
|
||||
});
|
||||
|
||||
promise.fail((xhr) => {
|
||||
dispatch(set({
|
||||
section,
|
||||
isFetching: false,
|
||||
isPopulated: false,
|
||||
error: xhr
|
||||
}));
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export default interactiveImportActionHandlers;
|
Loading…
Add table
Add a link
Reference in a new issue