Skip to content

Commit

Permalink
address search: misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
NC-jsAhonen committed Sep 12, 2023
1 parent e240f3c commit 22a73b3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/components/address-search/AddressSearchInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import {findFromOcdString} from '$util/helpers';

const SERVICE_MAP_URL = 'https://api.hel.fi/servicemap/v2';
type Language = 'fi' | 'sv';
const MINIMUM_SEARCH_STRING = 4
const MINIMUM_SEARCH_STRING = 3
const DEBOUNCE_TIME_MILLISECONDS = 500

type Address = {
object_type: string,
Expand Down Expand Up @@ -245,14 +246,11 @@ class AddressSearchInput extends Component<Props, State> {

const fetchResults = async() => {
const fiResponse = await fetchByKeyword('fi');
// const svResponse = await fetchByKeyword('sv');

const fiResults = await fiResponse.json();
// const svResults = await svResponse.json();

return [
...fiResults.results.map((address) => ({...address, language: 'fi'})),
// ...svResults.results.map((address) => ({...address, language: 'sv'})),
];
};

Expand All @@ -275,7 +273,7 @@ class AddressSearchInput extends Component<Props, State> {
this.setState({isLoading: false});
console.error(`Failed to fetch by keyword with error ${error}`);
});
}, 750)
}, DEBOUNCE_TIME_MILLISECONDS)

handleOnChange = (e: any) => {
const {onChange} = this.props;
Expand Down

0 comments on commit 22a73b3

Please sign in to comment.