displays snackbar instead of greenscreen on bad url

This commit is contained in:
jessop 2019-04-19 14:05:55 -04:00
parent 9df7966bc2
commit 90a1b3d678
2 changed files with 4 additions and 4 deletions

View file

@ -4,6 +4,7 @@ import {
doBlurSearchInput, doBlurSearchInput,
doUpdateSearchQuery, doUpdateSearchQuery,
doSearch, doSearch,
doToast,
selectSearchValue, selectSearchValue,
selectSearchSuggestions, selectSearchSuggestions,
selectSearchBarFocused, selectSearchBarFocused,
@ -31,6 +32,7 @@ const perform = (dispatch, ownProps) => ({
dispatch(doUpdateSearchQuery('')); dispatch(doUpdateSearchQuery(''));
}, },
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)), updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
doShowSnackBar: message => dispatch(doToast({ isError: true, message })),
doFocus: () => dispatch(doFocusSearchInput()), doFocus: () => dispatch(doFocusSearchInput()),
doBlur: () => dispatch(doBlurSearchInput()), doBlur: () => dispatch(doBlurSearchInput()),
}); });

View file

@ -21,7 +21,7 @@ type Props = {
doFocus: () => void, doFocus: () => void,
doBlur: () => void, doBlur: () => void,
focused: boolean, focused: boolean,
doShowSnackBar: ({}) => void, doShowSnackBar: string => void,
}; };
type State = { type State = {
@ -96,9 +96,7 @@ class WunderBar extends React.PureComponent<Props, State> {
const query = value.trim(); const query = value.trim();
const showSnackError = () => { const showSnackError = () => {
doShowSnackBar({ doShowSnackBar('Invalid LBRY URL entered. Only A-Z, a-z, 0-9, and "-" allowed.');
message: __('Invalid LBRY URL entered. Only A-Z, a-z, 0-9, and "-" allowed.'),
});
}; };
// User selected a suggestion // User selected a suggestion