เพิ่ม role=> description

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-05-31 11:53:26 +07:00
parent 77c7574809
commit ecaab4fc5c

View file

@ -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,
// };
}
/**