Skip to content

Commit

Permalink
city === null
Browse files Browse the repository at this point in the history
  • Loading branch information
martinheppner committed Dec 30, 2023
1 parent ef41852 commit 6118e9f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/components/Search/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,16 @@ export function Search({
}
}
}

//setting searchPhrase to the value of the search parameter
if (!!range) {
setSearchPhrase(range);
setRegion({ value: range, label: range, type: "range" });
}
if (!!search) {
else if (!!search) {
setSearchPhrase(search);

if (!city && !search.includes(' ')) {
if (city === null && !search.includes(' ')) {
// If a search phrase is given and city is empty and the search term consists only of one word,
// we have to check, if the search term is a valid city_slug.If yes, we will store the search term as city.
cityEntry = allCities.find((e) => e.value == search.toLowerCase()); // find the city object in array "allCities"
Expand All @@ -143,18 +144,18 @@ export function Search({
}
}
}
// state might be useful for future enhancement or new feature related to Klimaticket
if (!!state) {
else if (!!state) {
// state might be useful for future enhancement or new feature related to Klimaticket
setSearchPhrase(state);
setRegion({ value: state, label: state, type: "state" });
}
// country might be useful for future enhancement or new feature related to Klimaticket
if (!!country) {
else if (!!country) {
// country might be useful for future enhancement or new feature related to Klimaticket
setSearchPhrase(country);
setRegion({ value: country, label: country, type: "country" });
}
// type might be useful for future enhancement or new feature related to Klimaticket
if (!!type) {
else if (!!type) {
// type might be useful for future enhancement or new feature related to Klimaticket
setSearchPhrase(type);
setRegion({ value: type, label: type, type: "type" });
}
Expand Down

0 comments on commit 6118e9f

Please sign in to comment.