zahmis 5 лет назад
Родитель
Сommit
ea807dce1d

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

@@ -33,13 +33,13 @@ const CustomBotWithoutProxySettingsAccordion = ({
 
 
   const updateSecretTokenHandler = async() => {
   const updateSecretTokenHandler = async() => {
     try {
     try {
-      await appContainer.apiv3.put('/slack-integration/custom-bot-without-proxy', {
+      const res = await appContainer.apiv3.put('/slack-integration/custom-bot-without-proxy', {
         slackSigningSecret,
         slackSigningSecret,
         slackBotToken,
         slackBotToken,
         currentBotType,
         currentBotType,
       });
       });
 
 
-      console.log('update secret', isConnectedToSlack);
+      const { isConnectedToSlack } = res.data.customBotWithoutProxySettingParams;
 
 
       if (isConnectedToSlack) {
       if (isConnectedToSlack) {
         onSetIsRegisterSlackCredentials(true);
         onSetIsRegisterSlackCredentials(true);

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

@@ -56,9 +56,7 @@ const SlackIntegration = (props) => {
 
 
   useEffect(() => {
   useEffect(() => {
     fetchData();
     fetchData();
-    setIsRegisterSlackCredentials(isConnectedToSlack);
-    console.log('useEffect in slackintegration');
-  }, [fetchData, isConnectedToSlack]);
+  }, [fetchData]);
 
 
   const handleBotTypeSelect = (clickedBotType) => {
   const handleBotTypeSelect = (clickedBotType) => {
     if (clickedBotType === currentBotType) {
     if (clickedBotType === currentBotType) {
@@ -86,10 +84,10 @@ const SlackIntegration = (props) => {
       setSelectedBotType(null);
       setSelectedBotType(null);
       toastSuccess(t('admin:slack_integration.bot_reset_successful'));
       toastSuccess(t('admin:slack_integration.bot_reset_successful'));
       setIsRegisterSlackCredentials(false);
       setIsRegisterSlackCredentials(false);
+      setIsConnectedToSlack(false);
       setSlackSigningSecret(null);
       setSlackSigningSecret(null);
       setSlackBotToken(null);
       setSlackBotToken(null);
       setIsSendTestMessage(false);
       setIsSendTestMessage(false);
-      console.log('botchange', isConnectedToSlack);
     }
     }
     catch (err) {
     catch (err) {
       toastError(err);
       toastError(err);

+ 1 - 0
src/server/routes/apiv3/slack-integration.js

@@ -202,6 +202,7 @@ module.exports = (crowi) => {
           slackSigningSecret: crowi.configManager.getConfig('crowi', 'slackbot:signingSecret'),
           slackSigningSecret: crowi.configManager.getConfig('crowi', 'slackbot:signingSecret'),
           slackBotToken: crowi.configManager.getConfig('crowi', 'slackbot:token'),
           slackBotToken: crowi.configManager.getConfig('crowi', 'slackbot:token'),
           slackBotType: crowi.configManager.getConfig('crowi', 'slackbot:currentBotType'),
           slackBotType: crowi.configManager.getConfig('crowi', 'slackbot:currentBotType'),
+          isConnectedToSlack: crowi.slackBotService.isConnectedToSlack,
         };
         };
         return res.apiv3({ customBotWithoutProxySettingParams });
         return res.apiv3({ customBotWithoutProxySettingParams });
       }
       }

+ 0 - 1
src/server/service/slackbot.js

@@ -36,7 +36,6 @@ class SlackBotService extends S2sMessageHandlable {
       this.client = new WebClient(token, { logLevel: LogLevel.DEBUG });
       this.client = new WebClient(token, { logLevel: LogLevel.DEBUG });
       logger.debug('SlackBot: setup is done');
       logger.debug('SlackBot: setup is done');
       this.isSetupSlackBot = true;
       this.isSetupSlackBot = true;
-      console.log(this.isConnectedToSlack);
       await this.sendAuthTest();
       await this.sendAuthTest();
     }
     }