Implement basic code for creating/updating a subuser
This commit is contained in:
parent
51c5cf4dbb
commit
a6f46d36ba
17 changed files with 347 additions and 322 deletions
18
resources/scripts/api/server/users/createOrUpdateSubuser.ts
Normal file
18
resources/scripts/api/server/users/createOrUpdateSubuser.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import http from '@/api/http';
|
||||
import { rawDataToServerSubuser } from '@/api/server/users/getServerSubusers';
|
||||
import { Subuser } from '@/state/server/subusers';
|
||||
|
||||
interface Params {
|
||||
email: string;
|
||||
permissions: string[];
|
||||
}
|
||||
|
||||
export default (uuid: string, params: Params, subuser?: Subuser): Promise<Subuser> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
http.post(`/api/client/servers/${uuid}/users${subuser ? `/${subuser.uuid}` : ''}`, {
|
||||
...params,
|
||||
})
|
||||
.then(data => resolve(rawDataToServerSubuser(data.data)))
|
||||
.catch(reject);
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue