changeset 3334:8c96b7379aea

client: fairway availability: made store action work with both types of feature objects
author Markus Kottlaender <markus@intevation.de>
date Mon, 20 May 2019 17:14:47 +0200
parents d5dbfba9faae
children 59db0b5921c5
files client/src/store/fairwayavailability.js
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/store/fairwayavailability.js	Mon May 20 16:54:52 2019 +0200
+++ b/client/src/store/fairwayavailability.js	Mon May 20 17:14:47 2019 +0200
@@ -110,10 +110,14 @@
     loadAvailableFairwayDepth: ({ commit }, options) => {
       return new Promise((resolve, reject) => {
         const { feature, from, to, frequency, LOS } = options;
+        let name =
+          feature.constructor.name === "Feature"
+            ? feature.get("objnam")
+            : feature.properties.name;
         const start = encodeURIComponent("00:00:00+00:00");
         const end = encodeURIComponent("23:59:59+00:00");
         const URL = `/data/bottleneck/fairway-depth/${encodeURIComponent(
-          feature.properties.name
+          name
         )}?from=${from}T${start}&to=${to}T${end}&mode=${frequency}&los=${LOS}`;
         HTTP.get(URL, {
           headers: { "X-Gemma-Auth": localStorage.getItem("token") }