changeset 3685:8775bea8042a

client: layers: unset layer config on logout
author Markus Kottlaender <markus@intevation.de>
date Tue, 18 Jun 2019 14:39:36 +0200
parents 2babdaa32709
children 59572a03cec6
files client/src/components/map/Map.vue client/src/components/map/layers.js client/src/lib/session.js
diffstat 3 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/map/Map.vue	Tue Jun 18 14:15:29 2019 +0200
+++ b/client/src/components/map/Map.vue	Tue Jun 18 14:39:36 2019 +0200
@@ -41,7 +41,7 @@
 import { Stroke, Style, Fill } from "ol/style";
 import { displayError } from "@/lib/errors";
 import { pane } from "@/lib/mixins";
-import layers from "@/components/map/layers";
+import { layerFactory } from "@/components/map/layers";
 import "ol/ol.css";
 
 /* for the sake of debugging */
@@ -63,7 +63,7 @@
     ...mapState("application", ["paneSetup", "paneRotate"]),
     ...mapState("imports", ["selectedStretchId", "selectedSectionId"]),
     layers() {
-      return layers(this.paneId);
+      return layerFactory(this.paneId);
     },
     hasActiveInteractions() {
       return (
--- a/client/src/components/map/layers.js	Tue Jun 18 14:15:29 2019 +0200
+++ b/client/src/components/map/layers.js	Tue Jun 18 14:39:36 2019 +0200
@@ -169,9 +169,13 @@
   }
 });
 
-const layerConfigs = {};
+let layerConfigs = {};
 
-export default function(mapId) {
+export const unsetLayerConfigs = function() {
+  layerConfigs = {};
+};
+
+export const layerFactory = function(mapId) {
   const styles = styleFactory(mapId);
   // Shared feature source for layers:
   // BOTTLENECKS, BOTTLENECKSTATUS and BOTTLENECKFAIRWAYAVAILABILITY
@@ -660,4 +664,4 @@
     },
     config
   };
-}
+};
--- a/client/src/lib/session.js	Tue Jun 18 14:15:29 2019 +0200
+++ b/client/src/lib/session.js	Tue Jun 18 14:39:36 2019 +0200
@@ -13,12 +13,14 @@
  */
 
 import app from "@/main";
+import { unsetLayerConfigs } from "@/components/map/layers";
 
 const logOff = () => {
   app.$snotify.clear();
   app.$store.commit("reset");
   app.$store.commit("user/clearAuth");
   app.$router.push("/login");
+  unsetLayerConfigs();
 };
 
 /**