changeset 3477:4eefeeae03fc

client: fixed feature type check for production build In the production build code gets minified, which includes function names. So checking for a specific function name like (constructor.name) doesn't work.
author Markus Kottlaender <markus@intevation.de>
date Mon, 27 May 2019 13:58:19 +0200
parents cc11f207e060
children afab8d87932c
files client/src/store/fairwayavailability.js
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/store/fairwayavailability.js	Mon May 27 13:10:05 2019 +0200
+++ b/client/src/store/fairwayavailability.js	Mon May 27 13:58:19 2019 +0200
@@ -215,10 +215,9 @@
           type
         } = options;
         let { from, to } = options;
-        let name =
-          feature.constructor.name === "Feature"
-            ? feature.get("objnam")
-            : feature.properties.name;
+        let name = feature.hasOwnProperty("properties")
+          ? feature.properties.name
+          : feature.get("objnam");
         [from, to] = getIntervallBorders(from, to, frequency);
         let additionalParams = "";
         let endpoint = "";
@@ -277,10 +276,9 @@
           type
         } = options;
         let { from, to } = options;
-        let name =
-          feature.constructor.name === "Feature"
-            ? feature.get("objnam")
-            : feature.properties.name;
+        let name = feature.hasOwnProperty("properties")
+          ? feature.properties.name
+          : feature.get("objnam");
         [from, to] = getIntervallBorders(from, to, frequency);
         const start = encodeURIComponent("00:00:00+00:00");
         const end = encodeURIComponent("23:59:59+00:00");