Improved handling updating local settings

This commit is contained in:
Joel Collins 2019-11-20 17:04:59 +00:00
parent 3142c9a336
commit 04985e3ef9
2 changed files with 7 additions and 7 deletions

View file

@ -158,11 +158,9 @@ export default {
return new Promise(r => setTimeout(r, 500)); return new Promise(r => setTimeout(r, 500));
}) // why is there no built-in for this??! }) // why is there no built-in for this??!
.then(() => { .then(() => {
return this.$store.dispatch("updateConfig"); // Update local settings
}) this.updateSettings();
.then(this.updateInputValues) this.modalNotify("Camera settings applied.");
.then(() => {
console.log("Updated Config: ", payload);
}) })
.catch(error => { .catch(error => {
this.modalError(error); // Let mixin handle error this.modalError(error); // Let mixin handle error
@ -171,7 +169,8 @@ export default {
onRecalibrateResponse: function() { onRecalibrateResponse: function() {
this.modalNotify("Finished recalibration."); 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) { onRecalibrateError: function(error) {

View file

@ -116,8 +116,9 @@ export default {
axios axios
.put(this.settingsUri, payload) .put(this.settingsUri, payload)
.then(() => { .then(() => {
// Update local settings
this.updateSettings(); this.updateSettings();
this.modalNotify("Microscope config applied."); this.modalNotify("Microscope settings applied.");
}) })
.catch(error => { .catch(error => {
this.modalError(error); // Let mixin handle error this.modalError(error); // Let mixin handle error