From 8887996718b86f5444fcb86e60a3268e9bc1ec46 Mon Sep 17 00:00:00 2001 From: Dan Peterson Date: Thu, 23 Dec 2021 17:18:53 -0600 Subject: [PATCH] temporary hotfix for live api resp handling --- ui/redux/actions/livestream.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ui/redux/actions/livestream.js b/ui/redux/actions/livestream.js index 7c43bf220..d30caad48 100644 --- a/ui/redux/actions/livestream.js +++ b/ui/redux/actions/livestream.js @@ -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 } }); } };