Rename Episode Instances to Album to fix AlbumModal

This commit is contained in:
Qstick 2017-10-06 22:28:30 -04:00
parent bd3bd9a378
commit 02925245c2
25 changed files with 65 additions and 65 deletions

View file

@ -5,32 +5,32 @@ function createBatchToggleEpisodeMonitoredHandler(section, getFromState) {
return function(payload) {
return function(dispatch, getState) {
const {
episodeIds,
albumIds,
monitored
} = payload;
const state = getFromState(getState());
updateEpisodes(dispatch, section, state.items, episodeIds, {
updateEpisodes(dispatch, section, state.items, albumIds, {
isSaving: true
});
const promise = $.ajax({
url: '/episode/monitor',
method: 'PUT',
data: JSON.stringify({ episodeIds, monitored }),
data: JSON.stringify({ albumIds, monitored }),
dataType: 'json'
});
promise.done(() => {
updateEpisodes(dispatch, section, state.items, episodeIds, {
updateEpisodes(dispatch, section, state.items, albumIds, {
isSaving: false,
monitored
});
});
promise.fail(() => {
updateEpisodes(dispatch, section, state.items, episodeIds, {
updateEpisodes(dispatch, section, state.items, albumIds, {
isSaving: false
});
});

View file

@ -5,32 +5,32 @@ function createToggleEpisodeMonitoredHandler(section, getFromState) {
return function(payload) {
return function(dispatch, getState) {
const {
episodeId,
albumId,
monitored
} = payload;
const state = getFromState(getState());
updateEpisodes(dispatch, section, state.items, [episodeId], {
updateEpisodes(dispatch, section, state.items, [albumId], {
isSaving: true
});
const promise = $.ajax({
url: `/episode/${episodeId}`,
url: `/episode/${albumId}`,
method: 'PUT',
data: JSON.stringify({ monitored }),
dataType: 'json'
});
promise.done(() => {
updateEpisodes(dispatch, section, state.items, [episodeId], {
updateEpisodes(dispatch, section, state.items, [albumId], {
isSaving: false,
monitored
});
});
promise.fail(() => {
updateEpisodes(dispatch, section, state.items, [episodeId], {
updateEpisodes(dispatch, section, state.items, [albumId], {
isSaving: false
});
});

View file

@ -14,7 +14,7 @@ const episodeActionHandlers = {
[types.TOGGLE_EPISODE_MONITORED]: function(payload) {
return function(dispatch, getState) {
const {
episodeId: id,
albumId: id,
episodeEntity = episodeEntities.EPISODES,
monitored
} = payload;
@ -64,9 +64,9 @@ const episodeActionHandlers = {
const episodeSection = _.last(episodeEntity.split('.'));
dispatch(batchActions(
albumIds.map((episodeId) => {
albumIds.map((albumId) => {
return updateItem({
id: episodeId,
id: albumId,
section: episodeSection,
isSaving: true
});
@ -82,9 +82,9 @@ const episodeActionHandlers = {
promise.done((data) => {
dispatch(batchActions(
albumIds.map((episodeId) => {
albumIds.map((albumId) => {
return updateItem({
id: episodeId,
id: albumId,
section: episodeSection,
isSaving: false,
monitored
@ -95,9 +95,9 @@ const episodeActionHandlers = {
promise.fail((xhr) => {
dispatch(batchActions(
albumIds.map((episodeId) => {
albumIds.map((albumId) => {
return updateItem({
id: episodeId,
id: albumId,
section: episodeSection,
isSaving: false
});