Forráskód Böngészése

delete check function

zahmis 5 éve
szülő
commit
cf52927573

+ 5 - 12
src/client/js/components/Admin/SlackIntegration/CustomBotWithoutProxySettings.jsx

@@ -30,16 +30,6 @@ const CustomBotWithoutProxySettings = (props) => {
   const currentBotType = 'custom-bot-without-proxy';
   const currentBotType = 'custom-bot-without-proxy';
 
 
 
 
-  const checkCredentials = useCallback(() => {
-    if (slackBotToken && slackSigningSecret) {
-      return setIsRgisterSlackCredentials(true);
-    }
-    if (slackBotTokenEnv && slackSigningSecretEnv) {
-      return setIsRgisterSlackCredentials(true);
-    }
-    return setIsRgisterSlackCredentials(false);
-  }, [slackBotToken, slackBotTokenEnv, slackSigningSecret, slackSigningSecretEnv]);
-
   const fetchData = useCallback(async() => {
   const fetchData = useCallback(async() => {
     try {
     try {
       await adminAppContainer.retrieveAppSettingsData();
       await adminAppContainer.retrieveAppSettingsData();
@@ -54,11 +44,15 @@ const CustomBotWithoutProxySettings = (props) => {
       setSiteName(adminAppContainer.state.title);
       setSiteName(adminAppContainer.state.title);
       setIsSetupSlackBot(isSetupSlackBot);
       setIsSetupSlackBot(isSetupSlackBot);
       setIsConnectedToSlack(isConnectedToSlack);
       setIsConnectedToSlack(isConnectedToSlack);
+
+      if ((slackBotToken && slackSigningSecret) || (slackBotTokenEnv && slackSigningSecretEnv)) {
+        setIsRgisterSlackCredentials(true);
+      }
     }
     }
     catch (err) {
     catch (err) {
       toastError(err);
       toastError(err);
     }
     }
-  }, [appContainer, adminAppContainer]);
+  }, [appContainer, adminAppContainer, slackSigningSecretEnv, slackBotTokenEnv]);
 
 
   useEffect(() => {
   useEffect(() => {
     const getSlackWorkSpaceName = async() => {
     const getSlackWorkSpaceName = async() => {
@@ -89,7 +83,6 @@ const CustomBotWithoutProxySettings = (props) => {
         currentBotType,
         currentBotType,
       });
       });
       fetchData();
       fetchData();
-      checkCredentials();
       toastSuccess(t('toaster.update_successed', { target: t('admin:slack_integration.custom_bot_without_proxy_settings') }));
       toastSuccess(t('toaster.update_successed', { target: t('admin:slack_integration.custom_bot_without_proxy_settings') }));
     }
     }
     catch (err) {
     catch (err) {