zahmis пре 4 година
родитељ
комит
4003ed9e4c
1 измењених фајлова са 23 додато и 0 уклоњено
  1. 23 0
      src/client/js/components/Admin/SlackIntegration/SlackIntegration.jsx

+ 23 - 0
src/client/js/components/Admin/SlackIntegration/SlackIntegration.jsx

@@ -28,6 +28,7 @@ const SlackIntegration = (props) => {
   const [proxyServerUri, setProxyServerUri] = useState();
   const [proxyServerUri, setProxyServerUri] = useState();
   const [connectionStatuses, setConnectionStatuses] = useState({});
   const [connectionStatuses, setConnectionStatuses] = useState({});
   const [isLoading, setIsLoading] = useState(true);
   const [isLoading, setIsLoading] = useState(true);
+  const officialBotProxyUri = 'https://slackbot-proxy.growi.org/';
 
 
 
 
   const fetchSlackIntegrationData = useCallback(async() => {
   const fetchSlackIntegrationData = useCallback(async() => {
@@ -91,6 +92,17 @@ const SlackIntegration = (props) => {
         currentBotType: botType,
         currentBotType: botType,
       });
       });
       setSelectedBotType(null);
       setSelectedBotType(null);
+      if (botType === 'officialBot') {
+        try {
+          await appContainer.apiv3.put('/slack-integration-settings/proxy-uri', {
+            proxyUri: officialBotProxyUri,
+          });
+          toastSuccess(t('toaster.update_successed', { target: t('Proxy URL') }));
+        }
+        catch (err) {
+          toastError(err);
+        }
+      }
       fetchSlackIntegrationData();
       fetchSlackIntegrationData();
     }
     }
     catch (err) {
     catch (err) {
@@ -105,6 +117,17 @@ const SlackIntegration = (props) => {
     if (currentBotType == null) {
     if (currentBotType == null) {
       return changeCurrentBotSettings(botType);
       return changeCurrentBotSettings(botType);
     }
     }
+    if (botType === 'officialBot') {
+      try {
+        await appContainer.apiv3.put('/slack-integration-settings/proxy-uri', {
+          proxyUri: officialBotProxyUri,
+        });
+        toastSuccess(t('toaster.update_successed', { target: t('Proxy URL') }));
+      }
+      catch (err) {
+        toastError(err);
+      }
+    }
     setSelectedBotType(botType);
     setSelectedBotType(botType);
   };
   };