Skip to content

Commit 13c2da8

Browse files
committed
streams: Display error if stream update fails.
Displays a toast containing an error string if a call to updateExistingStream returns a failed promise. Fixes: #5286
1 parent 11cbbd1 commit 13c2da8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/streams/EditStreamScreen.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as NavigationService from '../nav/NavigationService';
88
import { useSelector, useDispatch } from '../react-redux';
99
import { updateExistingStream, navigateBack } from '../actions';
1010
import { getStreamForId } from '../selectors';
11+
import { showToast } from '../utils/info';
1112
import Screen from '../common/Screen';
1213
import EditStreamCard from './EditStreamCard';
1314

@@ -21,8 +22,14 @@ export default function EditStreamScreen(props: Props): Node {
2122
const stream = useSelector(state => getStreamForId(state, props.route.params.streamId));
2223

2324
const handleComplete = useCallback(
24-
(name: string, description: string, isPrivate: boolean) => {
25-
dispatch(updateExistingStream(stream.stream_id, stream, { name, description, isPrivate }));
25+
async (name: string, description: string, isPrivate: boolean) => {
26+
try {
27+
await dispatch(
28+
updateExistingStream(stream.stream_id, stream, { name, description, isPrivate }),
29+
);
30+
} catch (error) {
31+
showToast(error.message);
32+
}
2633
NavigationService.dispatch(navigateBack());
2734
},
2835
[stream, dispatch],

0 commit comments

Comments
 (0)