zahmis %!s(int64=4) %!d(string=hai) anos
pai
achega
5cdd18f2f7

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

@@ -6,6 +6,7 @@ import AdminAppContainer from '../../../services/AdminAppContainer';
 import { withUnstatedContainers } from '../../UnstatedUtils';
 import CustomBotWithoutProxySettingsAccordion, { botInstallationStep } from './CustomBotWithoutProxySettingsAccordion';
 import CustomBotWithoutProxyConnectionStatus from './CustomBotWithoutProxyConnectionStatus';
+import { addLogs } from './slak-integration-util';
 
 const CustomBotWithoutProxySettings = (props) => {
   const { appContainer, connectionStatuses, onTestConnectionInvoked } = props;
@@ -16,13 +17,13 @@ const CustomBotWithoutProxySettings = (props) => {
   const [connectionMessage, setConnectionMessage] = useState(null);
   const [testChannel, setTestChannel] = useState('');
 
-  const addLogs = (log) => {
-    const newLog = `${new Date()} - ${log.code}, ${log.message}\n\n`;
-    if (connectionMessage == null) {
-      return setConnectionMessage(newLog);
-    }
-    setConnectionMessage(`${newLog}${connectionMessage}`);
-  };
+  // const addLogs = (log) => {
+  //   const newLog = `${new Date()} - ${log.code}, ${log.message}\n\n`;
+  //   if (connectionMessage == null) {
+  //     return setConnectionMessage(newLog);
+  //   }
+  //   setConnectionMessage(`${newLog}${connectionMessage}`);
+  // };
 
   const testConnection = async() => {
     try {
@@ -35,7 +36,7 @@ const CustomBotWithoutProxySettings = (props) => {
       }
     }
     catch (err) {
-      addLogs(err[0]);
+      addLogs(err[0], connectionMessage, setConnectionMessage);
       setIsIntegrationSuccess(false);
     }
   };