From 7f6aae6eb8f07b71c32311347ddbce92a3874c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Thu, 19 Nov 2020 16:19:42 +0100 Subject: show unconnected nodes on map --- templates/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'templates') diff --git a/templates/index.js b/templates/index.js index b7b3b58..3edbd26 100644 --- a/templates/index.js +++ b/templates/index.js @@ -49,7 +49,6 @@ map.on('click', handleMapClick) function showMarker(){ var marker = L.marker([58.3984, 15.5733]).addTo(map) } - showMarker() async function showMarkers() { @@ -59,5 +58,13 @@ async function showMarkers() { var marker = L.marker(res[key]).addTo(map) } } - showMarkers() + +async function showUnconnectedMarkers() { + res = await fetch('/show-unconnected-nodes'); + res = await res.json(); + for (let key in res) { + var marker = L.marker(res[key]).addTo(map) + } +} +showUnconnectedMarkers() -- cgit v1.2.1 From 28bf2e9d0df6e093c80d62d5fc9a27bff7d87104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Tue, 15 Dec 2020 09:33:56 +0100 Subject: Apply 1 suggestion(s) to 1 file(s) --- templates/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates') diff --git a/templates/index.js b/templates/index.js index 3edbd26..0bbcdbe 100644 --- a/templates/index.js +++ b/templates/index.js @@ -62,7 +62,7 @@ showMarkers() async function showUnconnectedMarkers() { res = await fetch('/show-unconnected-nodes'); - res = await res.json(); + const res = await fetch('/show-unconnected-nodes').then(res => res.json()); for (let key in res) { var marker = L.marker(res[key]).addTo(map) } -- cgit v1.2.1 From 21a531eac5b953aeab14e4e8ae887695e8a4c4aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Tue, 15 Dec 2020 09:35:12 +0100 Subject: remove unused line --- templates/index.js | 1 - 1 file changed, 1 deletion(-) (limited to 'templates') diff --git a/templates/index.js b/templates/index.js index 0bbcdbe..01e3880 100644 --- a/templates/index.js +++ b/templates/index.js @@ -61,7 +61,6 @@ async function showMarkers() { showMarkers() async function showUnconnectedMarkers() { - res = await fetch('/show-unconnected-nodes'); const res = await fetch('/show-unconnected-nodes').then(res => res.json()); for (let key in res) { var marker = L.marker(res[key]).addTo(map) -- cgit v1.2.1