fix: toast not appearing when search results null

This commit is contained in:
ammarahm-ed
2020-03-09 18:33:40 +05:00
parent 81112f84a3
commit 0cd254c2db
3 changed files with 20 additions and 16 deletions

View File

@@ -98,20 +98,19 @@ export const Container = ({
data[0].data ? db.notes.all : data,
text,
);
if (!searchResults && searchResults.length < 0) {
ToastEvent.show('No search results found', 'error', 3000, () => {}, '');
if (!searchResult || searchResult.length === 0) {
ToastEvent.show('No search results found for ' + text, 'error');
return;
} else {
dispatch({
type: ACTIONS.SEARCH_RESULTS,
results: {
type,
results: searchResult,
keyword: text,
},
});
}
dispatch({
type: ACTIONS.SEARCH_RESULTS,
results: {
type,
results: searchResult,
keyword: text,
},
});
};
const onBlur = () => {