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