|
@@ -1,38 +1,39 @@
|
|
|
import React, { useMemo, useState } from 'react';
|
|
import React, { useMemo, useState } from 'react';
|
|
|
-import PropTypes from 'prop-types';
|
|
|
|
|
|
|
+
|
|
|
import { useTranslation } from 'next-i18next';
|
|
import { useTranslation } from 'next-i18next';
|
|
|
|
|
+import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
|
|
+import AdminSlackIntegrationLegacyContainer from '~/client/services/AdminSlackIntegrationLegacyContainer';
|
|
|
|
|
+import { toastError } from '~/client/util/apiNotification';
|
|
|
|
|
+import { toArrayIfNot } from '~/utils/array-utils';
|
|
|
import loggerFactory from '~/utils/logger';
|
|
import loggerFactory from '~/utils/logger';
|
|
|
|
|
|
|
|
import { withUnstatedContainers } from '../../UnstatedUtils';
|
|
import { withUnstatedContainers } from '../../UnstatedUtils';
|
|
|
-import { toastError } from '~/client/util/apiNotification';
|
|
|
|
|
-import { toArrayIfNot } from '~/utils/array-utils';
|
|
|
|
|
-import { withLoadingSppiner } from '../../SuspenseUtils';
|
|
|
|
|
|
|
|
|
|
-import AdminSlackIntegrationLegacyContainer from '~/client/services/AdminSlackIntegrationLegacyContainer';
|
|
|
|
|
|
|
|
|
|
import SlackConfiguration from './SlackConfiguration';
|
|
import SlackConfiguration from './SlackConfiguration';
|
|
|
|
|
|
|
|
const logger = loggerFactory('growi:NotificationSetting');
|
|
const logger = loggerFactory('growi:NotificationSetting');
|
|
|
|
|
|
|
|
-let retrieveErrors = null;
|
|
|
|
|
|
|
+const retrieveErrors = null;
|
|
|
function LegacySlackIntegration(props) {
|
|
function LegacySlackIntegration(props) {
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
const { adminSlackIntegrationLegacyContainer } = props;
|
|
const { adminSlackIntegrationLegacyContainer } = props;
|
|
|
|
|
|
|
|
if (adminSlackIntegrationLegacyContainer.state.webhookUrl === adminSlackIntegrationLegacyContainer.dummyWebhookUrl) {
|
|
if (adminSlackIntegrationLegacyContainer.state.webhookUrl === adminSlackIntegrationLegacyContainer.dummyWebhookUrl) {
|
|
|
- throw (async() => {
|
|
|
|
|
- try {
|
|
|
|
|
- await adminSlackIntegrationLegacyContainer.retrieveData();
|
|
|
|
|
- }
|
|
|
|
|
- catch (err) {
|
|
|
|
|
- const errs = toArrayIfNot(err);
|
|
|
|
|
- toastError(errs);
|
|
|
|
|
- logger.error(errs);
|
|
|
|
|
- retrieveErrors = errs;
|
|
|
|
|
- adminSlackIntegrationLegacyContainer.setState({ webhookUrl: adminSlackIntegrationLegacyContainer.dummyWebhookUrlForError });
|
|
|
|
|
- }
|
|
|
|
|
- })();
|
|
|
|
|
|
|
+ // TODO: SWRize adminSlackIntegrationLegacyContainer.retrieveData();
|
|
|
|
|
+ // throw (async() => {
|
|
|
|
|
+ // try {
|
|
|
|
|
+ // await adminSlackIntegrationLegacyContainer.retrieveData();
|
|
|
|
|
+ // }
|
|
|
|
|
+ // catch (err) {
|
|
|
|
|
+ // const errs = toArrayIfNot(err);
|
|
|
|
|
+ // toastError(errs);
|
|
|
|
|
+ // logger.error(errs);
|
|
|
|
|
+ // retrieveErrors = errs;
|
|
|
|
|
+ // adminSlackIntegrationLegacyContainer.setState({ webhookUrl: adminSlackIntegrationLegacyContainer.dummyWebhookUrlForError });
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (adminSlackIntegrationLegacyContainer.state.webhookUrl === adminSlackIntegrationLegacyContainer.dummyWebhookUrlForError) {
|
|
if (adminSlackIntegrationLegacyContainer.state.webhookUrl === adminSlackIntegrationLegacyContainer.dummyWebhookUrlForError) {
|
|
@@ -62,7 +63,7 @@ function LegacySlackIntegration(props) {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const LegacySlackIntegrationWithUnstatedContainer = withUnstatedContainers(withLoadingSppiner(LegacySlackIntegration), [AdminSlackIntegrationLegacyContainer]);
|
|
|
|
|
|
|
+const LegacySlackIntegrationWithUnstatedContainer = withUnstatedContainers(LegacySlackIntegration, [AdminSlackIntegrationLegacyContainer]);
|
|
|
|
|
|
|
|
LegacySlackIntegration.propTypes = {
|
|
LegacySlackIntegration.propTypes = {
|
|
|
adminSlackIntegrationLegacyContainer: PropTypes.instanceOf(AdminSlackIntegrationLegacyContainer).isRequired,
|
|
adminSlackIntegrationLegacyContainer: PropTypes.instanceOf(AdminSlackIntegrationLegacyContainer).isRequired,
|