We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9a15e6c commit 5809f11Copy full SHA for 5809f11
src/store/index.js
@@ -435,7 +435,14 @@ export default new Vuex.Store({
435
}
436
},
437
federation(state, federation) {
438
- state.federation = federation;
+ if (Array.isArray(federation)) {
439
+ // convert array of objects, which each have an `id` property, into an object with those IDs as the keys
440
+ // e.g. [ {id:'f',name:'foo'} ] -> { 'f': {id:'f',name:'foo'} }
441
+ state.federation = federation.reduce((arr, val) => ({ ...arr, [val.id]: val }), {})
442
+ } else {
443
+ // otherwise expect that it is already in that format
444
+ state.federation = federation;
445
+ }
446
447
federationMissing(state, federationMissing) {
448
state.federationMissing = federationMissing;
0 commit comments