Преглед на файлове

modify try catch in testConnection

zahmis преди 5 години
родител
ревизия
bccc3f904c
променени са 1 файла, в които са добавени 4 реда и са изтрити 4 реда
  1. 4 4
      src/client/js/components/Admin/SlackIntegration/CustomBotWithoutProxySettingsAccordion.jsx

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

@@ -69,16 +69,16 @@ const CustomBotWithoutProxySettingsAccordion = ({
     setConnectionSuccessMessage(null);
     // TODO: 5921 Add new Test endpoint
     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,
       });
-      setConnectionSuccessMessage(res.data.message);
+      setConnectionSuccessMessage('Send to message to slack ws.');
       onSetIsSendTestMessage(true);
     }
     catch (err) {
       onSetIsSendTestMessage(false);
-      setConnectionErrorCode('dummy-error-code');
-      setConnectionErrorMessage('This is a sample error message');
+      setConnectionErrorCode(err[0].code);
+      setConnectionErrorMessage(err[0].message);
     }
   };