[gnome-maps/wip/mlundblad/maps-uri: 1/6] photonGeocode: Only include the location params when requested
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/maps-uri: 1/6] photonGeocode: Only include the location params when requested
- Date: Thu, 4 Nov 2021 18:37:28 +0000 (UTC)
commit bbc8bfd755b2378ddb336828d2baca2e406d0e9c
Author: Marcus Lundblad <ml update uu se>
Date: Fri Oct 29 23:06:12 2021 +0200
photonGeocode: Only include the location params when requested
Only include the latitude and longitude parameters
when specified as non-null in the call.
src/photonGeocode.js | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/photonGeocode.js b/src/photonGeocode.js
index 0de55dd2..38d88ca2 100644
--- a/src/photonGeocode.js
+++ b/src/photonGeocode.js
@@ -135,10 +135,12 @@ var PhotonGeocode = class {
}
_buildURL(string, latitude, longitude) {
- let query = new HTTP.Query({ lat: latitude,
- lon: longitude,
- limit: string ? this._limit : 1
- });
+ let query = new HTTP.Query({ limit: string ? this._limit : 1 });
+
+ if (latitude !== null && longitude != null) {
+ query.add('lat', latitude);
+ query.add('lon', longitude);
+ }
if (string)
query.add('q', string);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]