Skip to content

Commit

Permalink
Push error with empty conference room to state
Browse files Browse the repository at this point in the history
  • Loading branch information
pe1ros committed Jun 10, 2022
1 parent 1fdce52 commit 9c4de51
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ConferenceDemo/src/Screens/Main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {useUtils} from '../../Utils/useUtils';
import {
changeCallState,
toggleSendVideo,
setError,
} from '../../Core/Store/conference/actions';
import {clearErrors} from '../../Core/Store/global/actions';
import {RootReducer} from '../../Core/Store';
Expand All @@ -37,16 +38,14 @@ const MainScreen = ({navigation}: IScreenProps<'Main'>) => {
} = useUtils();

const [conference, setConference] = useState('');
const [validationText, setValidationText] = useState('');

useEffect(() => {
validationText && setValidationText('');
error && dispatch(clearErrors());
}, [conference]);

const startConference = async (withVideo?: boolean) => {
if (!conference) {
setValidationText('Name cannot be empty');
dispatch(setError('Room cannot be empty'));
return;
}
if (withVideo) {
Expand Down Expand Up @@ -82,7 +81,7 @@ const MainScreen = ({navigation}: IScreenProps<'Main'>) => {
value={conference}
placeholder={'Type conference name here'}
setValue={setConference}
validationText={validationText || error}
validationText={error}
/>
<View style={styles.settingsWrapper}>
<CustomButton
Expand Down

0 comments on commit 9c4de51

Please sign in to comment.