diff client/src/store/bottlenecks.js @ 1296:99c039e86624

replaced manual store cleanup on logout with central store reset The store files now provide a init method with which the store can be resetted on logout. This is reasonable because missing store cleanups on logout caused bugs. Furthermore the localStorage.clear() was replaced specific removal of values since currently there are also saved cross profiles which should be persistent. The initialization of the cut/line/polygon tool was moved from their respective buttons to the map store right after saving the ol map object in the store. Before that change the map object was not present sometimes when trying to initiate those tools.
author Markus Kottlaender <markus@intevation.de>
date Thu, 22 Nov 2018 17:00:26 +0100
parents bc55ffaeb639
children ca33ad696594
line wrap: on
line diff
--- a/client/src/store/bottlenecks.js	Thu Nov 22 16:54:39 2018 +0100
+++ b/client/src/store/bottlenecks.js	Thu Nov 22 17:00:26 2018 +0100
@@ -16,14 +16,20 @@
 import { WFS } from "ol/format.js";
 import { displayError } from "../lib/errors.js";
 
-export default {
-  namespaced: true,
-  state: {
+// initial state
+const init = () => {
+  return {
     bottlenecks: [],
     selectedBottleneck: null,
     surveys: [],
     selectedSurvey: null
-  },
+  };
+};
+
+export default {
+  init,
+  namespaced: true,
+  state: init(),
   mutations: {
     setBottlenecks: (state, bottlenecks) => {
       state.bottlenecks = bottlenecks;