vuex-dot
vuex-dot copied to clipboard
Passing path for generalized mutations?
Hi :)
One thought, not sure if it makes sense, but wouldn't it be nice to be able to pass the path aside key and value to be able to have generalized mutations?
For example:
computed: {
...takeState('wizard.user')
.expose([
'name',
'email'
])
// .commit('EDIT_USER')
.commit('EDIT_ANY_GIVEN_PATH')
.map()
}
mutations: {
// EDIT_USER(state, { key, value }) {
EDIT_ANY_GIVEN_PATH(state, { key, value, path }) {
// Vue.set(state.wizard.user, key, value);
Vue.set(state[path], key, value);
}
}