no message

This commit is contained in:
kittapath 2025-01-29 12:13:16 +07:00
parent 0b8f9b6c23
commit a48656bdc9
2 changed files with 22 additions and 26 deletions

View file

@ -227,14 +227,7 @@ export async function getUserListOrg(first = "", max = "", search = "", userIds:
}
export async function getUserCountOrg(first = "", max = "", search = "", userIds: string[] = []) {
console.log(userIds);
const userIdsParam = userIds.join(",");
console.log(userIdsParam);
console.log("xxxxxxxxxxxxxxxxx");
console.log(
`${KC_URL}/admin/realms/${KC_REALMS}/users/count?first=${first || "0"}&max=${max || "-1"}${search ? `&search=${search}` : ""}${userIdsParam && userIdsParam != "" ? `&id=${userIdsParam}` : ""}`,
);
console.log("aaaaaaaaaaaaaaaaaa");
const res = await fetch(
`${KC_URL}/admin/realms/${KC_REALMS}/users/count?first=${first || "0"}&max=${max || "-1"}${search ? `&search=${search}` : ""}${userIdsParam && userIdsParam != "" ? `&id=${userIdsParam}` : ""}`,
{
@ -497,18 +490,15 @@ export async function getUserRoles(userId: string) {
* @returns true if success, false otherwise.
*/
export async function addUserRoles(userId: string, roles: { id: string; name: string }[]) {
const res = await fetch(
`${KC_URL}/admin/realms/${KC_REALMS}/users/${userId}`,
{
// prettier-ignore
headers: {
const res = await fetch(`${KC_URL}/admin/realms/${KC_REALMS}/users/${userId}`, {
// prettier-ignore
headers: {
"authorization": `Bearer ${await getToken()}`,
"content-type": `application/json`,
},
method: "POST",
body: JSON.stringify(roles),
},
).catch((e) => console.log(e));
method: "POST",
body: JSON.stringify(roles),
}).catch((e) => console.log(e));
if (!res) return false;
if (!res.ok) {