Mercurial > gemma
comparison 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 |
comparison
equal
deleted
inserted
replaced
1308:0e9dd3cd7b53 | 1309:3c91930367ee |
---|---|
192 }); | 192 }); |
193 }, | 193 }, |
194 confirm() { | 194 confirm() { |
195 let formData = new FormData(); | 195 let formData = new FormData(); |
196 formData.append("token", this.token); | 196 formData.append("token", this.token); |
197 const mapping = { | 197 if (this.bottleneck) formData.append("bottleneck", this.bottleneck); |
198 bottleneck: "bottleneck", | 198 if (this.importDate) |
199 importDate: "date", | 199 formData.append("date", this.importDate.split("T")[0]); |
200 depthReference: "depth-reference" | 200 if (this.depthReference) |
201 }; | 201 formData.append("depth-reference", this.depthReference); |
202 ["bottleneck", "importDate", "depthReference"].forEach(x => { | 202 |
203 if (this[x]) formData.append(mapping[x], this[x]); | |
204 }); | |
205 HTTP.post("/imports/soundingresult", formData, { | 203 HTTP.post("/imports/soundingresult", formData, { |
206 headers: { | 204 headers: { |
207 "X-Gemma-Auth": localStorage.getItem("token"), | 205 "X-Gemma-Auth": localStorage.getItem("token"), |
208 "Content-Type": "multipart/form-data" | 206 "Content-Type": "multipart/form-data" |
209 } | 207 } |