kaori 3 лет назад
Родитель
Сommit
74e50a56d3

+ 6 - 12
packages/app/src/components/Admin/LegacySlackIntegration/LegacySlackIntegration.jsx

@@ -5,7 +5,6 @@ import PropTypes from 'prop-types';
 
 import AdminSlackIntegrationLegacyContainer from '~/client/services/AdminSlackIntegrationLegacyContainer';
 import { toastError } from '~/client/util/apiNotification';
-import { useSWRxLegacySlackIntegrationSetting } from '~/stores/legacy-slack-integration';
 import { toArrayIfNot } from '~/utils/array-utils';
 import loggerFactory from '~/utils/logger';
 
@@ -16,19 +15,14 @@ import SlackConfiguration from './SlackConfiguration';
 
 const logger = loggerFactory('growi:NotificationSetting');
 
-// const retrieveErrors = null;
+const retrieveErrors = null;
 function LegacySlackIntegration(props) {
   const { t } = useTranslation();
-  const { data: legacySlackIntegrationSettingData } = useSWRxLegacySlackIntegrationSetting();
   const { adminSlackIntegrationLegacyContainer } = props;
 
-
-  useEffect(() => {
-
-  }, [legacySlackIntegrationSettingData]);
-
   if (adminSlackIntegrationLegacyContainer.state.webhookUrl === adminSlackIntegrationLegacyContainer.dummyWebhookUrl) {
-    // TODO: SWRize  adminSlackIntegrationLegacyContainer.retrieveData();
+    // TODO: Omit AdminSlackIntegrationLegacyContainer by https://redmine.weseek.co.jp/issues/100947
+
     // throw (async() => {
     //   try {
     //     await adminSlackIntegrationLegacyContainer.retrieveData();
@@ -43,9 +37,9 @@ function LegacySlackIntegration(props) {
     // })();
   }
 
-  // if (adminSlackIntegrationLegacyContainer.state.webhookUrl === adminSlackIntegrationLegacyContainer.dummyWebhookUrlForError) {
-  //   throw new Error(`${retrieveErrors.length} errors occured`);
-  // }
+  if (adminSlackIntegrationLegacyContainer.state.webhookUrl === adminSlackIntegrationLegacyContainer.dummyWebhookUrlForError) {
+    throw new Error(`${retrieveErrors.length} errors occured`);
+  }
 
   const isDisabled = adminSlackIntegrationLegacyContainer.state.isSlackbotConfigured;
 

+ 1 - 1
packages/app/src/components/Admin/LegacySlackIntegration/SlackConfiguration.jsx

@@ -1,7 +1,7 @@
 import React from 'react';
 
-import PropTypes from 'prop-types';
 import { useTranslation } from 'next-i18next';
+import PropTypes from 'prop-types';
 
 import AdminSlackIntegrationLegacyContainer from '~/client/services/AdminSlackIntegrationLegacyContainer';
 import { toastSuccess, toastError } from '~/client/util/apiNotification';

+ 0 - 10
packages/app/src/stores/legacy-slack-integration.ts

@@ -1,10 +0,0 @@
-import useSWR, { SWRResponse } from 'swr';
-
-import { apiv3Get } from '../client/util/apiv3-client';
-
-
-export const useSWRxLegacySlackIntegrationSetting = (): SWRResponse<any, Error> => {
-  return useSWR<any, Error>(
-    apiv3Get('/slack-integration-legacy-settings/').then(response => response.data),
-  );
-};