เพิ่ม role=> description
This commit is contained in:
parent
77c7574809
commit
ecaab4fc5c
1 changed files with 15 additions and 14 deletions
|
|
@ -151,21 +151,18 @@ export async function getUserList(first = "", max = "", search = "") {
|
|||
}
|
||||
|
||||
export async function getUserCount() {
|
||||
const res = await fetch(
|
||||
`${KC_URL}/admin/realms/${KC_REALM}/users/count`,
|
||||
{
|
||||
headers: {
|
||||
"authorization": `Bearer ${await getToken()}`,
|
||||
const res = await fetch(`${KC_URL}/admin/realms/${KC_REALM}/users/count`, {
|
||||
headers: {
|
||||
authorization: `Bearer ${await getToken()}`,
|
||||
"content-type": `application/json`,
|
||||
},
|
||||
},
|
||||
).catch((e) => console.log("Keycloak Error: ", e));
|
||||
|
||||
}).catch((e) => console.log("Keycloak Error: ", e));
|
||||
|
||||
if (!res) return false;
|
||||
if (!res.ok) {
|
||||
return Boolean(console.error("Keycloak Error Response: ", await res.json()));
|
||||
}
|
||||
|
||||
|
||||
return await res.json();
|
||||
}
|
||||
|
||||
|
|
@ -283,13 +280,17 @@ export async function getRoles(name?: string) {
|
|||
const data = (await res.json()) as any;
|
||||
|
||||
if (Array.isArray(data)) {
|
||||
return data.map((v: Record<string, string>) => ({ id: v.id, name: v.name }));
|
||||
return data.map((v: Record<string, string>) => ({
|
||||
id: v.id,
|
||||
name: v.name,
|
||||
description: v.description,
|
||||
}));
|
||||
}
|
||||
|
||||
return {
|
||||
id: data.id,
|
||||
name: data.name,
|
||||
};
|
||||
// return {
|
||||
// id: data.id,
|
||||
// name: data.name,
|
||||
// };
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue