diff --git a/src/store/modules/users.js b/src/store/modules/users.js index f30f90ba4..d88995579 100644 --- a/src/store/modules/users.js +++ b/src/store/modules/users.js @@ -37,6 +37,16 @@ const mutations = { SET_ORGS: (state, orgs) => { state.orgs = orgs }, + MODIFY_ORG: (state, org) => { + console.log(state.orgs) + state.orgs = state.orgs.map(oldOrg => { + if (oldOrg.id === org.id) { + oldOrg.name = org.name + } + return oldOrg + } + ) + }, ADD_ORG: (state, org) => { state.orgs.push(org) }, @@ -125,6 +135,9 @@ const actions = { addAdminOrg({ commit, state }, org) { commit('ADD_ORG', org) }, + modifyOrg({ commit, state }, org) { + commit('MODIFY_ORG', org) + }, // user logout logout({ commit, state }) { return new Promise((resolve, reject) => {