Add support for editing a subuser

This commit is contained in:
Dane Everitt
2020-03-27 15:40:24 -07:00
parent 1270e51248
commit ee81de6534
3 changed files with 29 additions and 8 deletions

View File

@@ -38,7 +38,20 @@ const subusers: ServerSubuserStore = {
}),
appendSubuser: action((state, payload) => {
state.data = [ ...state.data.filter(user => user.uuid !== payload.uuid), payload ];
let matched = false;
state.data = [
...state.data
.map(user => {
if (user.uuid === payload.uuid) {
matched = true;
return payload;
}
return user;
})
.concat(matched ? [] : [ payload ]),
];
}),
removeSubuser: action((state, payload) => {