the_news: check if we're connected prior to asking for nextTransition

This commit is contained in:
Marks Polakovs 2020-05-10 11:03:04 +02:00
parent b11de69b0a
commit ebfde59120

View file

@ -51,13 +51,15 @@ const considerDoingTheNews = (getState: () => RootState) => async () => {
if (state.settings.doTheNews === "always") {
await actuallyDoTheNews();
} else if (state.settings.doTheNews === "while_live") {
const transition = await broadcastApiRequest<{
autoNews: boolean;
selSource: number;
switchAudioAtMin: number;
}>("/nextTransition", "GET", {});
if (transition.autoNews) {
await actuallyDoTheNews();
if (state.broadcast.connectionState === "CONNECTED" || state.broadcast.connectionState === "LIVE") {
const transition = await broadcastApiRequest<{
autoNews: boolean;
selSource: number;
switchAudioAtMin: number;
}>("/nextTransition", "GET", {});
if (transition.autoNews) {
await actuallyDoTheNews();
}
}
}
};