nominatim

This commit is contained in:
Fedor Katurov 2020-01-20 17:52:21 +07:00
parent 3a988d23df
commit 0fd656e5fa

View file

@ -12,6 +12,7 @@ import {
} from './middleware'; } from './middleware';
import { IRoute } from '~/redux/map/types'; import { IRoute } from '~/redux/map/types';
import { INominatimResult } from '~/redux/types'; import { INominatimResult } from '~/redux/types';
import { MainMap } from '~/constants/map';
const arrayToObject = (array: any[], key: string): {} => const arrayToObject = (array: any[], key: string): {} =>
array.reduce((obj, el) => ({ ...obj, [el[key]]: el }), {}); array.reduce((obj, el) => ({ ...obj, [el[key]]: el }), {});
@ -193,7 +194,14 @@ export const searchNominatim = (query: string) =>
CLIENT && CLIENT &&
CLIENT.NOMINATIM_URL && CLIENT.NOMINATIM_URL &&
axios axios
.get(`${CLIENT.NOMINATIM_URL}${query}`, { params: { format: 'json', country_code: 'ru', 'accept-language': 'ru_RU' } }) .get(`${CLIENT.NOMINATIM_URL} ${query}`, {
params: {
format: 'json',
country_code: 'ru',
'accept-language': 'ru_RU',
dedupe: 1,
},
})
.then( .then(
data => data =>
data && data &&