Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onSubmit: ({ searchInput }, dispatch) => {
if (isMixed(searchInput) || isEmpty(searchInput)) {
// TODO: notify? shake? color searchbar?
console.warn("Invalid search input");
return false;
}
const payload = {
meaningContains: isRomaji(searchInput) ? searchInput : "",
readingContains: isJapanese(searchInput) ? searchInput : "",
};
return dispatch(app.review.search.request(payload));
},
})(SearchBar);
onSubmit: ({ searchInput }, dispatch) => {
if (isMixed(searchInput) || isEmpty(searchInput)) {
// TODO: notify? shake? color searchbar?
console.warn('Invalid search input');
return false;
}
const payload = {
meaningContains: isRomaji(searchInput) ? searchInput : '',
readingContains: isJapanese(searchInput) ? searchInput : '',
};
return dispatch(app.review.search.request(payload));
},
})(SearchBar);
onSubmit: ({ keywords }, dispatch, form) => {
if (isMixed(keywords)) {
form.stopSubmit({ keywords: 'Mixed input' });
} else {
const query = {};
if (isRomaji(keywords)) {
query.meaningContains = keywords.toLowerCase();
} else if (isJapanese(keywords)) {
query.readingContains = keywords;
}
dispatch(search.query.request(query, { form }));
}
},
})(SearchBar);