فهرست منبع

add case of official

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 [connectionStatuses, setConnectionStatuses] = useState({});
   const [isLoading, setIsLoading] = useState(true);
+  const officialBotProxyUri = 'https://slackbot-proxy.growi.org/';
 
 
   const fetchSlackIntegrationData = useCallback(async() => {
@@ -91,6 +92,17 @@ const SlackIntegration = (props) => {
         currentBotType: botType,
       });
       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();
     }
     catch (err) {
@@ -105,6 +117,17 @@ const SlackIntegration = (props) => {
     if (currentBotType == null) {
       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);
   };