no message

This commit is contained in:
kittapath 2025-01-29 15:31:32 +07:00
parent a48656bdc9
commit 7a0ab2271d

View file

@ -490,15 +490,18 @@ export async function getUserRoles(userId: string) {
* @returns true if success, false otherwise. * @returns true if success, false otherwise.
*/ */
export async function addUserRoles(userId: string, roles: { id: string; name: string }[]) { export async function addUserRoles(userId: string, roles: { id: string; name: string }[]) {
const res = await fetch(`${KC_URL}/admin/realms/${KC_REALMS}/users/${userId}`, { const res = await fetch(
// prettier-ignore `${KC_URL}/admin/realms/${KC_REALMS}/users/${userId}/role-mappings/realm`,
headers: { {
// prettier-ignore
headers: {
"authorization": `Bearer ${await getToken()}`, "authorization": `Bearer ${await getToken()}`,
"content-type": `application/json`, "content-type": `application/json`,
}, },
method: "POST", method: "POST",
body: JSON.stringify(roles), body: JSON.stringify(roles),
}).catch((e) => console.log(e)); },
).catch((e) => console.log(e));
if (!res) return false; if (!res) return false;
if (!res.ok) { if (!res.ok) {