temporary hotfix for live api resp handling

This commit is contained in:
Dan Peterson 2021-12-23 17:18:53 -06:00 committed by Thomas Zarebczan
parent 3040b9ea12
commit 8887996718

View file

@ -57,9 +57,13 @@ const fetchLiveChannels = async () => {
const fetchLiveChannel = async (channelId: string) => {
const response = await fetch(`${LIVESTREAM_LIVE_API}/${channelId}`);
const json = await response.json();
if (!(json.data && json.data.live)) throw new Error();
return transformLivestreamData([json.data]);
try {
const json = await response.json();
if (!(json.data && json.data.live)) throw new Error();
return transformLivestreamData([json.data]);
} catch {
throw new Error('Error handling live API response');
}
};
const filterUpcomingLiveStreamClaims = (upcomingClaims) => {
@ -176,6 +180,7 @@ export const doFetchActiveLivestream = (channelId: string) => {
},
});
} catch (err) {
if (err.message === 'Error handling live API response') return;
dispatch({ type: ACTIONS.FETCH_ACTIVE_LIVESTREAM_FAILED, data: { channelId } });
}
};