Add error handling to disable episode refresh icon
This commit is contained in:
parent
7fe76d6433
commit
a6052828ab
@ -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 seasonIndex = show.seasons.map((el) => el.season).indexOf(data.season.toString());
|
||||||
let episodeIndex = show.seasons[seasonIndex].episodes.map((el) => el.episode).indexOf(data.episode);
|
let episodeIndex = show.seasons[seasonIndex].episodes.map((el) => el.episode).indexOf(data.episode);
|
||||||
if ('id' in data) {
|
if ('id' in data) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user