From a6052828ab7389a6eb7c01b99ea4c0bfe8a1635c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Delattre?= Date: Wed, 1 Feb 2017 14:35:42 +0100 Subject: [PATCH] Add error handling to disable episode refresh icon --- src/public/js/reducers/shows.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/public/js/reducers/shows.js b/src/public/js/reducers/shows.js index f817644..3349b09 100644 --- a/src/public/js/reducers/shows.js +++ b/src/public/js/reducers/shows.js @@ -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) {