changeset 3850:0d0e52612c32

client: reload config right after saving it to make sure everything is updated
author Markus Kottlaender <markus@intevation.de>
date Mon, 08 Jul 2019 17:24:50 +0200
parents 4a584a99bec9
children 45eab8e9b580
files client/src/components/systemconfiguration/MorphologyClassbreaks.vue client/src/store/application.js
diffstat 2 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/systemconfiguration/MorphologyClassbreaks.vue	Mon Jul 08 17:07:38 2019 +0200
+++ b/client/src/components/systemconfiguration/MorphologyClassbreaks.vue	Mon Jul 08 17:24:50 2019 +0200
@@ -231,14 +231,16 @@
       this.activeColorPicker = this.activeColorPicker === id ? null : id;
     },
     submit() {
-      this.$store.dispatch("application/saveConfig", {
-        morphology_classbreaks: this.morphologyClassbreaks
-          .map(cb => (cb[1] === "#ffffff" ? cb[0] : cb.join(":")))
-          .join(","),
-        morphology_classbreaks_compare: this.morphologyClassbreaksCompare
-          .map(cb => (cb[1] === "#ffffff" ? cb[0] : cb.join(":")))
-          .join(",")
-      });
+      this.$store
+        .dispatch("application/saveConfig", {
+          morphology_classbreaks: this.morphologyClassbreaks
+            .map(cb => (cb[1] === "#ffffff" ? cb[0] : cb.join(":")))
+            .join(","),
+          morphology_classbreaks_compare: this.morphologyClassbreaksCompare
+            .map(cb => (cb[1] === "#ffffff" ? cb[0] : cb.join(":")))
+            .join(",")
+        })
+        .finally(() => this.$store.dispatch("application/loadConfig"));
     }
   },
   mounted() {
--- a/client/src/store/application.js	Mon Jul 08 17:07:38 2019 +0200
+++ b/client/src/store/application.js	Mon Jul 08 17:24:50 2019 +0200
@@ -143,14 +143,14 @@
   },
   actions: {
     loadConfig({ commit }) {
-      HTTP.get("/system/settings", {
+      return HTTP.get("/system/settings", {
         headers: { "X-Gemma-Auth": localStorage.getItem("token") }
       }).then(response => {
         commit("config", response.data);
       });
     },
     saveConfig(context, config) {
-      HTTP.put("/system/settings", config, {
+      return HTTP.put("/system/settings", config, {
         headers: {
           "X-Gemma-Auth": localStorage.getItem("token"),
           "Content-type": "application/json"