Mercurial > gemma
diff client/src/store/imports.js @ 1942:d1b7b1c70410
import stretch: listview with edit-function
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Mon, 21 Jan 2019 16:53:12 +0100 |
parents | 1aa864cccddc |
children | f64bc12c1719 |
line wrap: on
line diff
--- a/client/src/store/imports.js Mon Jan 21 15:49:51 2019 +0100 +++ b/client/src/store/imports.js Mon Jan 21 16:53:12 2019 +0100 @@ -14,6 +14,7 @@ import { HTTP } from "@/lib/http"; import Vue from "vue"; +import { WFS } from "ol/format.js"; /* eslint-disable no-unused-vars */ /* eslint-disable no-unreachable */ @@ -115,10 +116,6 @@ setStretches: (state, stretches) => { state.stretches = stretches; }, - // only for prototype purposes delete after real backend is active - addStretch: (state, stretch) => { - state.stretches.push(stretch); - }, clearCurrentSchedule: state => { state.currentSchedule = initializeCurrentSchedule(); }, @@ -219,13 +216,28 @@ }, actions: { loadStretches({ commit }) { - throw new Error("Endpoint not activated!"); return new Promise((resolve, reject) => { - HTTP.get("/imports/stretch", { - headers: { "X-Gemma-Auth": localStorage.getItem("token") } - }) + var stretchesFeatureCollectionRequest = new WFS().writeGetFeature({ + srsName: "EPSG:4326", + featureNS: "gemma", + featurePrefix: "gemma", + featureTypes: ["stretches"], + outputFormat: "application/json" + }); + HTTP.post( + "/internal/wfs", + new XMLSerializer().serializeToString( + stretchesFeatureCollectionRequest + ), + { + headers: { + "X-Gemma-Auth": localStorage.getItem("token"), + "Content-type": "text/xml; charset=UTF-8" + } + } + ) .then(response => { - commit("setStretches", response.data); + commit("setStretches", response.data.features); resolve(response); }) .catch(error => { @@ -239,7 +251,6 @@ headers: { "X-Gemma-Auth": localStorage.getItem("token") } }) .then(response => { - commit("setStretches", response.data); resolve(response); }) .catch(error => {