minimize the rest of the sharedcomputedobject

This commit is contained in:
Henry Jameson 2023-03-12 16:55:39 +02:00
parent ac32997f8b
commit 947b73f870
1 changed files with 3 additions and 11 deletions

View File

@ -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 })
}
}])
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {})
expertLevel () {
return this.$store.getters.mergedConfig.expertLevel > 0
}
})
export default SharedComputedObject