mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-24 22:35:39 -04:00
New: Custom Filtering for UI (#234)
This commit is contained in:
@@ -2,40 +2,40 @@ import $ from 'jquery';
|
||||
import updateAlbums from 'Utilities/Album/updateAlbums';
|
||||
import getSectionState from 'Utilities/State/getSectionState';
|
||||
|
||||
function createBatchToggleAlbumMonitoredHandler(section) {
|
||||
return function(payload) {
|
||||
return function(dispatch, getState) {
|
||||
const {
|
||||
albumIds,
|
||||
function createBatchToggleAlbumMonitoredHandler(section, fetchHandler) {
|
||||
return function(getState, payload, dispatch) {
|
||||
const {
|
||||
albumIds,
|
||||
monitored
|
||||
} = payload;
|
||||
|
||||
const state = getSectionState(getState(), section, true);
|
||||
|
||||
dispatch(updateAlbums(section, state.items, albumIds, {
|
||||
isSaving: true
|
||||
}));
|
||||
|
||||
const promise = $.ajax({
|
||||
url: '/album/monitor',
|
||||
method: 'PUT',
|
||||
data: JSON.stringify({ albumIds, monitored }),
|
||||
dataType: 'json'
|
||||
});
|
||||
|
||||
promise.done(() => {
|
||||
dispatch(updateAlbums(section, state.items, albumIds, {
|
||||
isSaving: false,
|
||||
monitored
|
||||
} = payload;
|
||||
}));
|
||||
|
||||
const state = getSectionState(getState(), section, true);
|
||||
dispatch(fetchHandler());
|
||||
});
|
||||
|
||||
updateAlbums(dispatch, section, state.items, albumIds, {
|
||||
isSaving: true
|
||||
});
|
||||
|
||||
const promise = $.ajax({
|
||||
url: '/album/monitor',
|
||||
method: 'PUT',
|
||||
data: JSON.stringify({ albumIds, monitored }),
|
||||
dataType: 'json'
|
||||
});
|
||||
|
||||
promise.done(() => {
|
||||
updateAlbums(dispatch, section, state.items, albumIds, {
|
||||
isSaving: false,
|
||||
monitored
|
||||
});
|
||||
});
|
||||
|
||||
promise.fail(() => {
|
||||
updateAlbums(dispatch, section, state.items, albumIds, {
|
||||
isSaving: false
|
||||
});
|
||||
});
|
||||
};
|
||||
promise.fail(() => {
|
||||
dispatch(updateAlbums(section, state.items, albumIds, {
|
||||
isSaving: false
|
||||
}));
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user