|
|
@@ -1,4 +1,4 @@
|
|
|
-import React from 'react';
|
|
|
+import React, { useEffect } from 'react';
|
|
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
@@ -13,23 +13,21 @@ import LdapSecuritySettingContents from './LdapSecuritySettingContents';
|
|
|
let retrieveErrors = null;
|
|
|
function LdapSecuritySetting(props) {
|
|
|
const { adminLdapSecurityContainer } = props;
|
|
|
- // if (adminLdapSecurityContainer.state.serverUrl === adminLdapSecurityContainer.dummyServerUrl) {
|
|
|
- // throw (async() => {
|
|
|
- // try {
|
|
|
- // await adminLdapSecurityContainer.retrieveSecurityData();
|
|
|
- // }
|
|
|
- // catch (err) {
|
|
|
- // const errs = toArrayIfNot(err);
|
|
|
- // toastError(errs);
|
|
|
- // retrieveErrors = errs;
|
|
|
- // adminLdapSecurityContainer.setState({ serverUrl: adminLdapSecurityContainer.dummyServerUrlForError });
|
|
|
- // }
|
|
|
- // })();
|
|
|
- // }
|
|
|
-
|
|
|
- // if (adminLdapSecurityContainer.state.serverUrl === adminLdapSecurityContainer.dummyServerUrlForError) {
|
|
|
- // throw new Error(`${retrieveErrors.length} errors occured`);
|
|
|
- // }
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ const fetchLdapSecuritySettingsData = async() => {
|
|
|
+ await adminLdapSecurityContainer.retrieveSecurityData();
|
|
|
+ };
|
|
|
+
|
|
|
+ try {
|
|
|
+ fetchLdapSecuritySettingsData();
|
|
|
+ }
|
|
|
+ catch (err) {
|
|
|
+ const errs = toArrayIfNot(err);
|
|
|
+ toastError(errs);
|
|
|
+ logger.error(errs);
|
|
|
+ }
|
|
|
+ }, [adminLdapSecurityContainer]);
|
|
|
|
|
|
return <LdapSecuritySettingContents />;
|
|
|
}
|