Ver Fonte

add null check

zahmis há 5 anos atrás
pai
commit
248359b2d3

+ 9 - 8
src/client/js/components/Admin/SlackIntegration/CustomBotWithoutProxySettingsAccordion.jsx

@@ -16,7 +16,7 @@ export const botInstallationStep = {
 };
 
 const CustomBotWithoutProxySettingsAccordion = ({
-  appContainer, activeStep, fetchSlackIntegrationData,
+  appContainer, activeStep, fetchData,
   slackSigningSecret, slackSigningSecretEnv, slackBotToken, slackBotTokenEnv,
   isRegisterSlackCredentials, isSendTestMessage,
   onSetSlackSigningSecret, onSetSlackBotToken, onSetIsSendTestMessage,
@@ -31,6 +31,12 @@ const CustomBotWithoutProxySettingsAccordion = ({
   const [testChannel, setTestChannel] = useState('');
   const currentBotType = 'customBotWithoutProxy';
 
+  function fetchSlackIntegrationData() {
+    if (fetchData == null) {
+      return;
+    }
+    fetchData();
+  }
 
   const updateSecretTokenHandler = async() => {
     try {
@@ -39,12 +45,7 @@ const CustomBotWithoutProxySettingsAccordion = ({
         slackBotToken,
         currentBotType,
       });
-
-      if (fetchSlackIntegrationData != null) {
-        console.log('hoge');
-        fetchSlackIntegrationData();
-      }
-
+      fetchSlackIntegrationData();
       toastSuccess(t('toaster.update_successed', { target: t('admin:slack_integration.custom_bot_without_proxy_settings') }));
     }
     catch (err) {
@@ -213,7 +214,7 @@ CustomBotWithoutProxySettingsAccordion.propTypes = {
   isRegisterSlackCredentials: PropTypes.bool,
   isSendTestMessage: PropTypes.bool,
   isConnectedToSlack: PropTypes.bool,
-  fetchSlackIntegrationData: PropTypes.func,
+  fetchData: PropTypes.func,
   onSetSlackSigningSecret: PropTypes.func,
   onSetSlackBotToken: PropTypes.func,
   onSetIsSendTestMessage: PropTypes.func,

+ 1 - 1
src/client/js/components/Admin/SlackIntegration/SlackIntegration.jsx

@@ -118,7 +118,7 @@ const SlackIntegration = (props) => {
           onSetSlackSigningSecret={setSlackSigningSecret}
           onSetSlackBotToken={setSlackBotToken}
           onSetIsSendTestMessage={setIsSendTestMessage}
-          fetchSlackIntegrationhData={fetchData}
+          fetchData={fetchData}
         />
       );
       break;