Mercurial > gemma
diff client/src/store/bottlenecks.js @ 5572:3b842e951317 surveysperbottleneckid
change use from name of bottleneck to its id.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 20 Jul 2021 17:07:51 +0200 |
parents | 660147046ddd |
children | 271888ef85bc |
line wrap: on
line diff
--- a/client/src/store/bottlenecks.js Tue Jul 20 11:50:17 2021 +0200 +++ b/client/src/store/bottlenecks.js Tue Jul 20 17:07:51 2021 +0200 @@ -14,8 +14,8 @@ */ import { HTTP } from "@/lib/http"; import { WFS } from "ol/format"; +import { compareAsc } from "date-fns"; import { displayError } from "@/lib/errors"; -import { compareAsc } from "date-fns"; // initial state const init = () => { return { @@ -77,8 +77,8 @@ setBottlenecksList: (state, bottlenecksList) => { state.bottlenecksList = bottlenecksList; }, - setSelectedBottleneck: (state, name) => { - state.selectedBottleneck = name; + setSelectedBottleneck: (state, value) => { + state.selectedBottleneck = value; }, setSurveys(state, surveys) { state.surveys = surveys; @@ -98,9 +98,9 @@ } }, actions: { - setSelectedBottleneck({ state, commit, rootState }, name) { + setSelectedBottleneck({ state, commit, rootState }, id) { return new Promise((resolve, reject) => { - if (name !== state.selectedBottleneck) { + if (id !== state.selectedBottleneck) { commit("selectedSurvey", null); commit("fairwayprofile/additionalSurvey", null, { root: true }); commit("fairwayprofile/clearCurrentProfile", null, { root: true }); @@ -111,10 +111,10 @@ .clear(); }); } - commit("setSelectedBottleneck", name); - if (name) { + commit("setSelectedBottleneck", id); + if (id) { commit("surveysLoading", true); - HTTP.get("/surveys/" + encodeURIComponent(name), { + HTTP.get("/surveys/" + encodeURIComponent(id), { headers: { "X-Gemma-Auth": localStorage.getItem("token"), "Content-type": "text/xml; charset=UTF-8"