zahmis 4 năm trước cách đây
mục cha
commit
46a3fa7861

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

@@ -9,7 +9,7 @@ import CustomBotWithoutProxyIntegrationCard from './CustomBotWithoutProxyIntegra
 import DeleteSlackBotSettingsModal from './DeleteSlackBotSettingsModal';
 import DeleteSlackBotSettingsModal from './DeleteSlackBotSettingsModal';
 
 
 const CustomBotWithoutProxySettings = (props) => {
 const CustomBotWithoutProxySettings = (props) => {
-  const { appContainer, onResetSettings, isIntegrationSuccess } = props;
+  const { appContainer, onResetSettings } = props;
   const { t } = useTranslation();
   const { t } = useTranslation();
 
 
   const [siteName, setSiteName] = useState('');
   const [siteName, setSiteName] = useState('');
@@ -23,6 +23,24 @@ const CustomBotWithoutProxySettings = (props) => {
     onResetSettings();
     onResetSettings();
   };
   };
 
 
+  const testConnection = async() => {
+    setConnectionErrorCode(null);
+    setConnectionErrorMessage(null);
+    setConnectionSuccessMessage(null);
+    try {
+      await appContainer.apiv3.post('/slack-integration-settings/without-proxy/test', { channel: testChannel });
+      setConnectionSuccessMessage('Send to message to slack ws.');
+      onSetIsSendTestMessage(true);
+      onSetIsIntegrationSuccess(true);
+    }
+    catch (err) {
+      setConnectionErrorCode(err[0].code);
+      setConnectionErrorMessage(err[0].message);
+      onSetIsSendTestMessage(false);
+      onSetIsIntegrationSuccess(false);
+    }
+  };
+
   useEffect(() => {
   useEffect(() => {
     const siteName = appContainer.config.crowi.title;
     const siteName = appContainer.config.crowi.title;
     setSiteName(siteName);
     setSiteName(siteName);