Skip to content

Commit

Permalink
fix: error occured and match removed
Browse files Browse the repository at this point in the history
  • Loading branch information
amar-1995 committed May 22, 2024
1 parent 958447b commit eba3662
Showing 1 changed file with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useEffect, useMemo, useState } from 'react';
import { GridVideoTileLayout } from '@100mslive/types-prebuilt/elements/video_tile_layout';
import { match } from 'ts-pattern';
import {
HMSTranscriptionInfo,
selectLocalPeerID,
Expand Down Expand Up @@ -103,19 +102,12 @@ export const GridLayout = ({
const transcriptionStates: HMSTranscriptionInfo[] | undefined = useHMSStore(selectTranscriptionsState);

useEffect(() => {
if (transcriptionStates && transcriptionStates.length > 0) {
match({ state: transcriptionStates[0].state, error: transcriptionStates[0].error })
.when(
({ error }) => !!error,
() => {
ToastManager.addToast({
title: `Failed to enable Closed Caption`,
variant: 'error',
icon: <AlertTriangleIcon style={{ marginRight: '0.5rem' }} />,
});
},
)
.otherwise(() => null);
if (transcriptionStates && transcriptionStates.length > 0 && transcriptionStates[0].error) {
ToastManager.addToast({
title: `Failed to enable Closed Caption`,
variant: 'error',
icon: <AlertTriangleIcon style={{ marginRight: '0.5rem' }} />,
});
}
}, [transcriptionStates]);

Expand Down

0 comments on commit eba3662

Please sign in to comment.