Add support for editing a subuser
This commit is contained in:
parent
1270e51248
commit
ee81de6534
3 changed files with 29 additions and 8 deletions
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue