Add support for deleting a subuser from a server
This commit is contained in:
parent
a6f46d36ba
commit
1270e51248
11 changed files with 158 additions and 107 deletions
|
@ -1,5 +1,4 @@
|
|||
import { action, Action, thunk, Thunk } from 'easy-peasy';
|
||||
import getServerSubusers from '@/api/server/users/getServerSubusers';
|
||||
import { action, Action } from 'easy-peasy';
|
||||
|
||||
export type SubuserPermission =
|
||||
'websocket.*' |
|
||||
|
@ -28,7 +27,7 @@ export interface ServerSubuserStore {
|
|||
data: Subuser[];
|
||||
setSubusers: Action<ServerSubuserStore, Subuser[]>;
|
||||
appendSubuser: Action<ServerSubuserStore, Subuser>;
|
||||
getSubusers: Thunk<ServerSubuserStore, string, any, {}, Promise<void>>;
|
||||
removeSubuser: Action<ServerSubuserStore, string>;
|
||||
}
|
||||
|
||||
const subusers: ServerSubuserStore = {
|
||||
|
@ -42,10 +41,8 @@ const subusers: ServerSubuserStore = {
|
|||
state.data = [ ...state.data.filter(user => user.uuid !== payload.uuid), payload ];
|
||||
}),
|
||||
|
||||
getSubusers: thunk(async (actions, payload) => {
|
||||
const subusers = await getServerSubusers(payload);
|
||||
|
||||
actions.setSubusers(subusers);
|
||||
removeSubuser: action((state, payload) => {
|
||||
state.data = [ ...state.data.filter(user => user.uuid !== payload) ];
|
||||
}),
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue