diff client/src/components/map/contextbox/ImportSoundingresults.vue @ 1309:3c91930367ee

import sounding results: manually add formdata
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 23 Nov 2018 12:44:42 +0100
parents 0e9dd3cd7b53
children c539cb678c5b
line wrap: on
line diff
--- a/client/src/components/map/contextbox/ImportSoundingresults.vue	Fri Nov 23 12:04:26 2018 +0100
+++ b/client/src/components/map/contextbox/ImportSoundingresults.vue	Fri Nov 23 12:44:42 2018 +0100
@@ -194,14 +194,12 @@
     confirm() {
       let formData = new FormData();
       formData.append("token", this.token);
-      const mapping = {
-        bottleneck: "bottleneck",
-        importDate: "date",
-        depthReference: "depth-reference"
-      };
-      ["bottleneck", "importDate", "depthReference"].forEach(x => {
-        if (this[x]) formData.append(mapping[x], this[x]);
-      });
+      if (this.bottleneck) formData.append("bottleneck", this.bottleneck);
+      if (this.importDate)
+        formData.append("date", this.importDate.split("T")[0]);
+      if (this.depthReference)
+        formData.append("depth-reference", this.depthReference);
+
       HTTP.post("/imports/soundingresult", formData, {
         headers: {
           "X-Gemma-Auth": localStorage.getItem("token"),