mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix loop when cannot fetch roles (#41901)
This commit is contained in:
parent
c5241731de
commit
d66158a042
@ -60,11 +60,16 @@ export const fetchUserRoles = async (userId: number, orgId?: number): Promise<Ro
|
|||||||
if (orgId) {
|
if (orgId) {
|
||||||
userRolesUrl += `?targetOrgId=${orgId}`;
|
userRolesUrl += `?targetOrgId=${orgId}`;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
const roles = await getBackendSrv().get(userRolesUrl);
|
const roles = await getBackendSrv().get(userRolesUrl);
|
||||||
if (!roles || !roles.length) {
|
if (!roles || !roles.length) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return roles;
|
return roles;
|
||||||
|
} catch (error) {
|
||||||
|
error.isHandled = true;
|
||||||
|
return [];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const updateUserRoles = (roleUids: string[], userId: number, orgId?: number) => {
|
export const updateUserRoles = (roleUids: string[], userId: number, orgId?: number) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user