]> git.openstreetmap.org Git - nominatim-ui.git/commitdiff
when calling API skip any empty parameter values
authormarc tobias <mtmail@gmx.net>
Mon, 18 May 2020 11:07:27 +0000 (13:07 +0200)
committermarc tobias <mtmail@gmx.net>
Mon, 18 May 2020 11:07:27 +0000 (13:07 +0200)
dist/assets/js/nominatim-ui.js
src/assets/js/base.js

index cbfb4dfe8a429d1e63177f5042a8b467908c4e18..ac6e97b18979df8ad9df6a19aeb27a4a8a157b06 100644 (file)
@@ -61,13 +61,13 @@ function map_viewbox_as_string() {
 // *********************************************************
 
 function fetch_from_api(endpoint_name, params, callback) {
+  //
   // `&a=&b=&c=1` => '&c=1'
-
   var param_names = Object.keys(params);
   for (var i = 0; i < param_names.length; i += 1) {
-    var val = param_names[i];
+    var val = params[param_names[i]];
     if (typeof (val) === 'undefined' || val === '' || val === null) {
-      delete param_names[i];
+      delete params[param_names[i]];
     }
   }
 
index a8f6d0a11b53d26c02bf7d93386a3e53b8e93659..27f93af7c0c6851073cc8fa4162118ae28645bb0 100644 (file)
@@ -61,13 +61,13 @@ function map_viewbox_as_string() {
 // *********************************************************
 
 function fetch_from_api(endpoint_name, params, callback) {
+  //
   // `&a=&b=&c=1` => '&c=1'
-
   var param_names = Object.keys(params);
   for (var i = 0; i < param_names.length; i += 1) {
-    var val = param_names[i];
+    var val = params[param_names[i]];
     if (typeof (val) === 'undefined' || val === '' || val === null) {
-      delete param_names[i];
+      delete params[param_names[i]];
     }
   }