From eeb15c624a5fbef0134ad6d22a0baf1916688ef9 Mon Sep 17 00:00:00 2001 From: Orange Date: Fri, 25 Sep 2020 19:04:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E6=9B=B4=E6=96=B0=E5=88=97=E8=A1=A8=E6=9C=AA?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/users.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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) => {