]> git.openstreetmap.org Git - nominatim-ui.git/commitdiff
details page: on error (HTTP 400) show message (#58)
authormtmail <mtmail@gmx.net>
Mon, 8 Feb 2021 19:40:04 +0000 (20:40 +0100)
committerGitHub <noreply@github.com>
Mon, 8 Feb 2021 19:40:04 +0000 (20:40 +0100)
src/pages/DetailsPage.svelte

index 45fc1d46c80f1c44ee99c12f55a33f4ba2ecf627..5b8c1ce5e51d84c8cfa1eb265a023683464b3a72 100644 (file)
@@ -13,6 +13,7 @@
   import Map from '../components/Map.svelte';
 
   let aPlace;
+  let errorResponse;
   let base_url = window.location.search;
 
   function loaddata() {
       }
 
       fetch_from_api('details', api_request_params, function (data) {
-        aPlace = data;
-        current_result_store.set(data);
+        if (data.error) {
+          errorResponse = data;
+          current_result_store.set(undefined);
+        } else {
+          aPlace = data;
+          errorResponse = undefined;
+          current_result_store.set(data);
+        }
       });
     } else {
       aPlace = undefined;
@@ -51,6 +58,9 @@
 
 </script>
 
+{#if errorResponse}
+  {errorResponse.error.message}
+{/if}
 {#if aPlace}
   <div class="container">
     <div class="row">