Skip to content

Commit f96ef76

Browse files
committed
Fix lint, validate sources parameter
1 parent 32f2808 commit f96ef76

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/util/searchUtils.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,14 @@ function getFavouriteLocations(favourites, input) {
147147
}
148148

149149
export function getGeocodingResult(
150-
text,
150+
_text,
151151
searchParams,
152152
lang,
153153
focusPoint,
154154
sources,
155155
config,
156156
) {
157-
158-
if (text) {
159-
text = text.trim();
160-
}
157+
const text = _text ? _text.trim() : null;
161158
if (
162159
text === undefined ||
163160
text === null ||
@@ -169,7 +166,10 @@ export function getGeocodingResult(
169166
return Promise.resolve([]);
170167
}
171168

172-
const opts = { text, ...searchParams, ...focusPoint, lang, sources };
169+
let opts = { text, ...searchParams, ...focusPoint, lang };
170+
if (sources) {
171+
opts = { ...opts, sources };
172+
}
173173

174174
return getJson(config.URL.PELIAS, opts)
175175
.then(res =>

0 commit comments

Comments
 (0)