Skip to content

Commit

Permalink
FIX: added prevent default for the search form
Browse files Browse the repository at this point in the history
  • Loading branch information
barbaraperic committed Apr 9, 2024
1 parent 1c211af commit 3b35b23
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,20 @@ export default function Home(props) {
}
>
<div className="container">
<form className="formRow">
<form
onSubmit={(e) => {
handelSearch(
e,
queryString,
optionsList,
selectedOption,
displayData,
setDisplayData,
accordionState,
setAccordionState,
setSearchError
)}}
className="formRow">
<div className="selectInputWrapper">
<CustomSelect
selectedOption={selectedOption}
Expand All @@ -860,6 +873,7 @@ export default function Home(props) {
onKeyUp={(e) => {
if (e.code == "Enter") {
handelSearch(
e,
queryString,
optionsList,
selectedOption,
Expand All @@ -876,18 +890,7 @@ export default function Home(props) {
</div>
<button
className="btn btn-primary btn-sm"
onClick={() =>
handelSearch(
queryString,
optionsList,
selectedOption,
displayData,
setDisplayData,
accordionState,
setAccordionState,
setSearchError
)
}
type="submit"
>
<span>Search</span>
</button>
Expand Down Expand Up @@ -1479,6 +1482,7 @@ function base64ToBytesArr(str) {
}

function handelSearch(
event,
queryString,
optionsList,
selectedOption,
Expand All @@ -1488,6 +1492,7 @@ function handelSearch(
setAccordionState,
setSearchError
) {
event.preventDefault()
onSearch(
queryString,
optionsList,
Expand Down

0 comments on commit 3b35b23

Please sign in to comment.