Removed all whole mess of manual watch/data declaration, now fully automatic

This commit is contained in:
Henry Jameson 2019-09-29 23:47:26 +03:00
parent 979e170bd6
commit 39b71e5dd6
4 changed files with 102 additions and 230 deletions

View file

@ -1,5 +1,6 @@
import { set } from 'vue'
import { setPreset } from '../services/style_setter/style_setter.js'
import { instanceDefaultProperties } from './config.js'
const defaultState = {
// Stuff from static/config.json and apiConfig
@ -72,6 +73,13 @@ const instance = {
}
}
},
getters: {
instanceDefaultConfig (state) {
return instanceDefaultProperties
.map(key => [key, state[key]])
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {})
}
},
actions: {
setInstanceOption ({ commit, dispatch }, { name, value }) {
commit('setInstanceOption', { name, value })