feat: add linking UGs to Users

This commit is contained in:
swve 2024-03-30 17:32:29 +00:00
parent d1d817678b
commit e173a32e3c
9 changed files with 235 additions and 20 deletions

View file

@ -19,6 +19,24 @@ export async function createUserGroup(body: any) {
return res
}
export async function linkUserToUserGroup(usergroup_id: any, user_id: any) {
const result: any = await fetch(
`${getAPIUrl()}usergroups/${usergroup_id}/add_users?user_ids=${user_id}`,
RequestBody('POST', null, null)
)
const res = await getResponseMetadata(result)
return res
}
export async function unLinkUserToUserGroup(usergroup_id: any, user_id: any) {
const result: any = await fetch(
`${getAPIUrl()}usergroups/${usergroup_id}/remove_users?user_ids=${user_id}`,
RequestBody('DELETE', null, null)
)
const res = await getResponseMetadata(result)
return res
}
export async function deleteUserGroup(usergroup_id: number) {
const result: any = await fetch(
`${getAPIUrl()}usergroups/${usergroup_id}`,