Skip to content

Commit

Permalink
Merge pull request #29 from barbaraperic/pr/search-form
Browse files Browse the repository at this point in the history
FIX: added prevent default for the search form
  • Loading branch information
willscott authored Apr 9, 2024
2 parents 2d2e048 + c18ff6c commit f4263d4
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 @@ -842,7 +842,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 @@ -863,6 +876,7 @@ export default function Home(props) {
onKeyUp={(e) => {
if (e.code == "Enter") {
handelSearch(
e,
queryString,
optionsList,
selectedOption,
Expand All @@ -879,18 +893,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 @@ -1533,6 +1536,7 @@ function base64ToBytesArr(str) {
}

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

0 comments on commit f4263d4

Please sign in to comment.