Skip to content

Commit

Permalink
streams: Display error if stream update fails.
Browse files Browse the repository at this point in the history
Displays a toast containing an error string if a call to
updateExistingStream returns a failed promise.

Fixes: #5286
  • Loading branch information
Fingel committed Mar 10, 2022
1 parent 11cbbd1 commit 3c8c792
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/streams/EditStreamScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as NavigationService from '../nav/NavigationService';
import { useSelector, useDispatch } from '../react-redux';
import { updateExistingStream, navigateBack } from '../actions';
import { getStreamForId } from '../selectors';
import { showToast } from '../utils/info';
import Screen from '../common/Screen';
import EditStreamCard from './EditStreamCard';

Expand All @@ -22,7 +23,11 @@ export default function EditStreamScreen(props: Props): Node {

const handleComplete = useCallback(
(name: string, description: string, isPrivate: boolean) => {
dispatch(updateExistingStream(stream.stream_id, stream, { name, description, isPrivate }));
dispatch(
updateExistingStream(stream.stream_id, stream, { name, description, isPrivate }),
).catch(error => {
showToast(error.message);
});
NavigationService.dispatch(navigateBack());
},
[stream, dispatch],
Expand Down

0 comments on commit 3c8c792

Please sign in to comment.