Procházet zdrojové kódy

modify try catch in testConnection

zahmis před 4 roky
rodič
revize
bccc3f904c

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

@@ -69,16 +69,16 @@ const CustomBotWithoutProxySettingsAccordion = ({
     setConnectionSuccessMessage(null);
     setConnectionSuccessMessage(null);
     // TODO: 5921 Add new Test endpoint
     // TODO: 5921 Add new Test endpoint
     try {
     try {
-      const res = await appContainer.apiv3.post('/slack-integration-settings/without-proxy/test', {
+      await appContainer.apiv3.post('/slack-integration-settings/without-proxy/test', {
         channel: testChannel,
         channel: testChannel,
       });
       });
-      setConnectionSuccessMessage(res.data.message);
+      setConnectionSuccessMessage('Send to message to slack ws.');
       onSetIsSendTestMessage(true);
       onSetIsSendTestMessage(true);
     }
     }
     catch (err) {
     catch (err) {
       onSetIsSendTestMessage(false);
       onSetIsSendTestMessage(false);
-      setConnectionErrorCode('dummy-error-code');
-      setConnectionErrorMessage('This is a sample error message');
+      setConnectionErrorCode(err[0].code);
+      setConnectionErrorMessage(err[0].message);
     }
     }
   };
   };