This commit is contained in:
parent
94c7de89eb
commit
8b26f91dba
1 changed files with 3 additions and 13 deletions
|
|
@ -347,7 +347,7 @@ export async function removeUserRoles(userId: string, roles: { id: string; name:
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getGroup() {
|
export async function getGroup() {
|
||||||
const res = await fetch(`${KC_URL}/admin/realms/${KC_REALM}/groups`, {
|
const res = await fetch(`${KC_URL}/admin/realms/${KC_REALM}/groups?q`, {
|
||||||
headers: {
|
headers: {
|
||||||
authorization: `Bearer ${await getToken()}`,
|
authorization: `Bearer ${await getToken()}`,
|
||||||
"content-type": `application/json`,
|
"content-type": `application/json`,
|
||||||
|
|
@ -356,20 +356,10 @@ export async function getGroup() {
|
||||||
});
|
});
|
||||||
|
|
||||||
const dataMainGroup = await res.json();
|
const dataMainGroup = await res.json();
|
||||||
|
|
||||||
const fetchSubGroups = async (group: any) => {
|
const fetchSubGroups = async (group: any) => {
|
||||||
const resSub = await fetch(`${KC_URL}/admin/realms/${KC_REALM}/groups/${group.id}/children`, {
|
|
||||||
headers: {
|
|
||||||
authorization: `Bearer ${await getToken()}`,
|
|
||||||
"content-type": `application/json`,
|
|
||||||
},
|
|
||||||
method: "GET",
|
|
||||||
});
|
|
||||||
|
|
||||||
const dataSubGroup = await resSub.json();
|
|
||||||
let fullSubGroup = await Promise.all(
|
let fullSubGroup = await Promise.all(
|
||||||
dataSubGroup.map(async (subGroupsData: any) => {
|
group.subGroups.map(async (subGroupsData: any) => {
|
||||||
if (subGroupsData.subGroupCount > 0) {
|
if (group.subGroupCount > 0) {
|
||||||
return await fetchSubGroups(subGroupsData);
|
return await fetchSubGroups(subGroupsData);
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue