diff options
Diffstat (limited to 'app/assets/javascripts/vuex_shared/bindings.js')
-rw-r--r-- | app/assets/javascripts/vuex_shared/bindings.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/assets/javascripts/vuex_shared/bindings.js b/app/assets/javascripts/vuex_shared/bindings.js new file mode 100644 index 00000000000..51035ebc8a8 --- /dev/null +++ b/app/assets/javascripts/vuex_shared/bindings.js @@ -0,0 +1,16 @@ +export const mapComputed = (root, updateFn, list) => { + const result = {}; + list.forEach(key => { + result[key] = { + get() { + return this.$store.state[root][key]; + }, + set(value) { + this.$store.dispatch(updateFn, { [key]: value }); + }, + }; + }); + return result; +}; + +export default () => {}; |