X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/82eae94284b6f0be5eeb1bc7e90350c4992994bf..cf3e8f8daa0f2f4b014b9df6c32a436248237140:/src/components/LastUpdated.svelte?ds=inline diff --git a/src/components/LastUpdated.svelte b/src/components/LastUpdated.svelte index a5b3277..0d7768d 100644 --- a/src/components/LastUpdated.svelte +++ b/src/components/LastUpdated.svelte @@ -9,11 +9,18 @@ let fetch_running = false; // prevent multiple parallel fetch runs last_api_request_url_store.subscribe(url => { + last_api_request_url = url; + + if (last_api_request_url) { + last_api_request_url = new URL(last_api_request_url, window.location.origin); + last_api_request_url.searchParams.delete('polygon_geojson'); + last_api_request_url = last_api_request_url.toString(); + } + if (fetch_running || last_updated_date) return; fetch_running = true; - last_api_request_url = url; fetch_from_api('status', { format: 'json' }, function (data) { last_updated_date = data.data_updated; fetch_running = false; @@ -41,7 +48,7 @@
-
+
Loading data from API ...
@@ -55,10 +62,12 @@
{/if}
-
+
{#if last_updated_date} Data last updated: - {timeago.format(new Date(last_updated_date))} + + {timeago.format(new Date(last_updated_date))} + {/if} (Details)