minimize the rest of the sharedcomputedobject

merge-requests/1845/head
Henry Jameson 2 years ago
parent ac32997f8b
commit 947b73f870

@ -1,18 +1,10 @@
import { defaultState as configDefaultState } from 'src/modules/config.js'
const SharedComputedObject = () => ({
user () {
return this.$store.state.users.currentUser
},
// Generating computed values for vuex properties
...Object.keys(configDefaultState)
.map(key => [key, {
get () { return this.$store.getters.mergedConfig[key] },
set (value) {
this.$store.dispatch('setOption', { name: key, value })
expertLevel () {
return this.$store.getters.mergedConfig.expertLevel > 0
}
}])
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {})
})
export default SharedComputedObject

Loading…
Cancel
Save