comparison client/src/store/bottlenecks.js @ 1096:aa1f5daf6fc9

refac: centralized stores
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 30 Oct 2018 16:55:29 +0100
parents
children f106aee673e7
comparison
equal deleted inserted replaced
1095:2d6d8b676e3f 1096:aa1f5daf6fc9
1 /*
2 * This is Free Software under GNU Affero General Public License v >= 3.0
3 * without warranty, see README.md and license for details.
4 *
5 * SPDX-License-Identifier: AGPL-3.0-or-later
6 * License-Filename: LICENSES/AGPL-3.0.txt
7 *
8 * Copyright (C) 2018 by via donau
9 * – Österreichische Wasserstraßen-Gesellschaft mbH
10 * Software engineering by Intevation GmbH
11 *
12 * Author(s):
13 * Markus Kottländer <markuks.kottlaender@intevation.de>
14 */
15 import { HTTP } from "../application/lib/http";
16 import { WFS } from "ol/format.js";
17
18 const Bottlenecks = {
19 namespaced: true,
20 state: {
21 bottlenecks: []
22 },
23 mutations: {
24 setBottlenecks: (state, bottlenecks) => {
25 state.bottlenecks = bottlenecks;
26 }
27 },
28 actions: {
29 loadBottlenecks({ commit }) {
30 var bottleneckFeatureCollectionRequest = new WFS().writeGetFeature({
31 srsName: "EPSG:4326",
32 featureNS: "gemma",
33 featurePrefix: "gemma",
34 featureTypes: ["bottleneck_overview"],
35 outputFormat: "application/json"
36 });
37
38 HTTP.post(
39 "/internal/wfs",
40 new XMLSerializer().serializeToString(
41 bottleneckFeatureCollectionRequest
42 ),
43 {
44 headers: {
45 "X-Gemma-Auth": localStorage.getItem("token"),
46 "Content-type": "text/xml; charset=UTF-8"
47 }
48 }
49 ).then(response => {
50 commit("setBottlenecks", response.data.features);
51 });
52 }
53 }
54 };
55
56 export default Bottlenecks;