From 04985e3ef96a882506333bc0f72fd62233a802f6 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Wed, 20 Nov 2019 17:04:59 +0000 Subject: [PATCH] Improved handling updating local settings --- .../settingsComponents/cameraSettings.vue | 11 +++++------ .../settingsComponents/microscopeSettings.vue | 3 ++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/controlComponents/settingsComponents/cameraSettings.vue b/src/components/controlComponents/settingsComponents/cameraSettings.vue index e16be14a..4c15c9f1 100644 --- a/src/components/controlComponents/settingsComponents/cameraSettings.vue +++ b/src/components/controlComponents/settingsComponents/cameraSettings.vue @@ -158,11 +158,9 @@ export default { return new Promise(r => setTimeout(r, 500)); }) // why is there no built-in for this??! .then(() => { - return this.$store.dispatch("updateConfig"); - }) - .then(this.updateInputValues) - .then(() => { - console.log("Updated Config: ", payload); + // Update local settings + this.updateSettings(); + this.modalNotify("Camera settings applied."); }) .catch(error => { this.modalError(error); // Let mixin handle error @@ -171,7 +169,8 @@ export default { onRecalibrateResponse: function() { this.modalNotify("Finished recalibration."); - return new Promise(r => setTimeout(r, 500)); // wait 500ms before updating config, so it's fresh + // Update local settings + this.updateSettings(); }, onRecalibrateError: function(error) { diff --git a/src/components/controlComponents/settingsComponents/microscopeSettings.vue b/src/components/controlComponents/settingsComponents/microscopeSettings.vue index 0cac76a1..21d32201 100644 --- a/src/components/controlComponents/settingsComponents/microscopeSettings.vue +++ b/src/components/controlComponents/settingsComponents/microscopeSettings.vue @@ -116,8 +116,9 @@ export default { axios .put(this.settingsUri, payload) .then(() => { + // Update local settings this.updateSettings(); - this.modalNotify("Microscope config applied."); + this.modalNotify("Microscope settings applied."); }) .catch(error => { this.modalError(error); // Let mixin handle error