Add error handling to disable episode refresh icon

This commit is contained in:
Grégoire Delattre 2017-02-01 14:35:42 +01:00
parent 7fe76d6433
commit a6052828ab

View File

@ -82,7 +82,17 @@ export default function showStore(state = defaultState, action) {
}
}
function updateEpisode(show, fetching, data) {
function updateEpisode(show, fetching, data = null) {
// Error handling for PouuleT
if (data === null) {
for (let seasonIndex of Object.keys(show.seasons)) {
for (let episodeIndex of Object.keys(show.seasons[seasonIndex].episodes)) {
show.seasons[seasonIndex].episodes[episodeIndex].fetching = false;
}
}
return show
}
let seasonIndex = show.seasons.map((el) => el.season).indexOf(data.season.toString());
let episodeIndex = show.seasons[seasonIndex].episodes.map((el) => el.episode).indexOf(data.episode);
if ('id' in data) {