feat: init usergroup linking to a course

This commit is contained in:
swve 2024-03-30 10:22:38 +00:00
parent a6152ef1f5
commit 4f75e6a90a
12 changed files with 428 additions and 55 deletions

View file

@ -0,0 +1,35 @@
import { getAPIUrl } from '@services/config/config'
import { RequestBody, getResponseMetadata } from '@services/utils/ts/requests'
export async function getUserGroups(org_id: any) {
const result: any = await fetch(
`${getAPIUrl()}usergroups/org/${org_id}`,
RequestBody('GET', null, null)
)
const res = await getResponseMetadata(result)
return res
}
export async function linkResourcesToUserGroup(
usergroup_id: any,
resource_uuids: any
) {
const result: any = await fetch(
`${getAPIUrl()}usergroups/${usergroup_id}/add_resources?resource_uuids=${resource_uuids}`,
RequestBody('POST', null, null)
)
const res = await getResponseMetadata(result)
return res
}
export async function unLinkResourcesToUserGroup(
usergroup_id: any,
resource_uuids: any
) {
const result: any = await fetch(
`${getAPIUrl()}usergroups/${usergroup_id}/remove_resources?resource_uuids=${resource_uuids}`,
RequestBody('DELETE', null, null)
)
const res = await getResponseMetadata(result)
return res
}