New: Custom Filtering for UI (#234)

This commit is contained in:
Qstick
2018-03-14 21:28:46 -04:00
committed by GitHub
parent c6873014c7
commit 7354e02bff
154 changed files with 3498 additions and 1370 deletions
@@ -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
}));
});
};
}