aboutsummaryrefslogtreecommitdiff
path: root/src/modules/config.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/config.js')
-rw-r--r--src/modules/config.js22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/modules/config.js b/src/modules/config.js
index cd088737..f992519e 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -76,18 +76,22 @@ export const instanceDefaultProperties = Object.entries(defaultState)
.map(([key, value]) => key)
const config = {
- state: defaultState,
+ state: { ...defaultState },
getters: {
- mergedConfig (state, getters, rootState, rootGetters) {
+ defaultConfig (state, getters, rootState, rootGetters) {
const { instance } = rootState
return {
- ...state,
- ...instanceDefaultProperties
- .map(key => [key, state[key] === undefined
- ? instance[key]
- : state[key]
- ])
- .reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {})
+ ...defaultState,
+ ...Object.fromEntries(
+ instanceDefaultProperties.map(key => [key, instance[key]])
+ )
+ }
+ },
+ mergedConfig (state, getters, rootState, rootGetters) {
+ const { defaultConfig } = rootGetters
+ return {
+ ...defaultConfig,
+ ...state
}
}
},