mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
misc: added proper error handling
This commit is contained in:
@@ -13,9 +13,15 @@ export const useGetLDAPConfig = (organizationId: string) => {
|
||||
return useQuery({
|
||||
queryKey: ldapConfigKeys.getLDAPConfig(organizationId),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get(`/api/v1/ldap/config?organizationId=${organizationId}`);
|
||||
try {
|
||||
const { data } = await apiRequest.get(
|
||||
`/api/v1/ldap/config?organizationId=${organizationId}`
|
||||
);
|
||||
|
||||
return data;
|
||||
return data;
|
||||
} catch (err) {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
enabled: true
|
||||
});
|
||||
|
||||
@@ -12,11 +12,15 @@ export const useGetOIDCConfig = (orgSlug: string) => {
|
||||
return useQuery({
|
||||
queryKey: oidcConfigKeys.getOIDCConfig(orgSlug),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get<OIDCConfigData>(
|
||||
`/api/v1/sso/oidc/config?orgSlug=${orgSlug}`
|
||||
);
|
||||
try {
|
||||
const { data } = await apiRequest.get<OIDCConfigData>(
|
||||
`/api/v1/sso/oidc/config?orgSlug=${orgSlug}`
|
||||
);
|
||||
|
||||
return data;
|
||||
return data;
|
||||
} catch (err) {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
enabled: true
|
||||
});
|
||||
|
||||
@@ -11,9 +11,15 @@ export const useGetSSOConfig = (organizationId: string) => {
|
||||
return useQuery({
|
||||
queryKey: ssoConfigKeys.getSSOConfig(organizationId),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get(`/api/v1/sso/config?organizationId=${organizationId}`);
|
||||
try {
|
||||
const { data } = await apiRequest.get(
|
||||
`/api/v1/sso/config?organizationId=${organizationId}`
|
||||
);
|
||||
|
||||
return data;
|
||||
return data;
|
||||
} catch (err) {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
enabled: true
|
||||
});
|
||||
|
||||
@@ -43,8 +43,10 @@ export const OrgAuthTab = withPermission(
|
||||
const { data: samlConfig, isLoading: isLoadingSamlConfig } = useGetSSOConfig(
|
||||
currentOrg?.id ?? ""
|
||||
);
|
||||
const { data: ldapConfig, isLoading: isLdapConfig } = useGetLDAPConfig(currentOrg?.id ?? "");
|
||||
const areConfigsLoading = isLoadingOidcConfig || isLoadingSamlConfig || isLdapConfig;
|
||||
const { data: ldapConfig, isLoading: isLoadingLdapConfig } = useGetLDAPConfig(
|
||||
currentOrg?.id ?? ""
|
||||
);
|
||||
const areConfigsLoading = isLoadingOidcConfig || isLoadingSamlConfig || isLoadingLdapConfig;
|
||||
|
||||
const shouldDisplaySection = (method: LoginMethod) =>
|
||||
!enabledLoginMethods || enabledLoginMethods.includes(method);
|
||||
|
||||
Reference in New Issue
Block a user