Commit 6b2e95a1 by Alexander Zobnin Committed by GitHub

LDAP debug page: deduplicate errors (#19168)

parent 5ef40b25
......@@ -38,6 +38,7 @@ export function loadLdapState(): ThunkResult<void> {
const connectionInfo = await getLdapState();
dispatch(ldapConnectionInfoLoadedAction(connectionInfo));
} catch (error) {
error.isHandled = true;
const ldapError = {
title: error.data.message,
body: error.data.error,
......@@ -63,6 +64,7 @@ export function loadUserMapping(username: string): ThunkResult<void> {
const userInfo = await getUserInfo(username);
dispatch(userMappingInfoLoadedAction(userInfo));
} catch (error) {
error.isHandled = true;
const userError = {
title: error.data.message,
body: error.data.error,
......@@ -106,6 +108,7 @@ export function loadLdapUserInfo(userId: number): ThunkResult<void> {
dispatch(loadUserSessions(userId));
dispatch(loadUserMapping(user.login));
} catch (error) {
error.isHandled = true;
const userError = {
title: error.data.message,
body: error.data.error,
......
......@@ -47,7 +47,6 @@ export const syncLdapUser = async (userId: number) => {
};
export const getUserInfo = async (username: string): Promise<LdapUser> => {
try {
const response = await getBackendSrv().get(`/api/admin/ldap/${username}`);
const { name, surname, email, login, isGrafanaAdmin, isDisabled, roles, teams } = response;
return {
......@@ -56,9 +55,6 @@ export const getUserInfo = async (username: string): Promise<LdapUser> => {
roles,
teams,
};
} catch (error) {
throw error;
}
};
export const getUser = async (id: number): Promise<User> => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment