mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-24 22:35:39 -04:00
Fixed: Batch Monitor/Unmonitor on Wanted Pages
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import $ from 'jquery';
|
||||
import updateAlbums from 'Utilities/Album/updateAlbums';
|
||||
|
||||
function createBatchToggleAlbumMonitoredHandler(section, getFromState) {
|
||||
return function(payload) {
|
||||
return function(dispatch, getState) {
|
||||
const {
|
||||
albumIds,
|
||||
monitored
|
||||
} = payload;
|
||||
|
||||
const state = getFromState(getState());
|
||||
|
||||
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
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export default createBatchToggleAlbumMonitoredHandler;
|
||||
Reference in New Issue
Block a user