Skip to content

Commit

Permalink
Fixed empty search error (#70)
Browse files Browse the repository at this point in the history
Fixed empty search error to avoid server error when empty string is searched. Now searching for empty string is a noop.

Co-authored-by: Aidan <aidanthegreat765@gmail.com>
  • Loading branch information
aidanz-1 and Aidan authored Nov 11, 2024
1 parent d74a917 commit 848a8d5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions components/CollapsibleSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ const CollapsibleSearch = () => {
};
function submitSearchRequest(e: FormEvent) {
e.preventDefault();
Router.push(String("/search?query=" + searchValue));
}
if (searchValue.trim()) {
Router.push(String("/search?query=" + searchValue));
}}

return (
<div id={styles.collapsible_search_parent}>
Expand Down Expand Up @@ -62,4 +63,4 @@ const CollapsibleSearch = () => {
);
};

export default CollapsibleSearch;
export default CollapsibleSearch;

0 comments on commit 848a8d5

Please sign in to comment.