no message
This commit is contained in:
parent
a48656bdc9
commit
7a0ab2271d
1 changed files with 9 additions and 6 deletions
|
|
@ -490,15 +490,18 @@ 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}/role-mappings/realm`,
|
||||
{
|
||||
// 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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue