2
0
zahmis 5 жил өмнө
parent
commit
638b043fd9

+ 16 - 15
src/client/js/components/Admin/SlackIntegration/SlackIntegration.jsx

@@ -49,10 +49,25 @@ const SlackIntegration = (props) => {
     }
   }, [appContainer.apiv3, currentBotType]);
 
+  const resetAllSettings = useCallback(async() => {
+    try {
+      await appContainer.apiv3.put('/slack-integration-settings/custom-bot-without-proxy', {
+        slackSigningSecret: '',
+        slackBotToken: '',
+        currentBotType: '',
+      });
+      toastSuccess('success');
+    }
+    catch (err) {
+      toastError(err);
+    }
+  }, [appContainer.apiv3]);
+
 
   useEffect(() => {
     fetchSlackIntegrationData();
-  }, [fetchSlackIntegrationData]);
+    resetAllSettings();
+  }, [fetchSlackIntegrationData, resetAllSettings]);
 
 
   const handleBotTypeSelect = (clickedBotType) => {
@@ -70,20 +85,6 @@ const SlackIntegration = (props) => {
     setSelectedBotType(null);
   };
 
-  const resetAllSettings = async() => {
-    try {
-      await appContainer.apiv3.put('/slack-integration-settings/custom-bot-without-proxy', {
-        slackSigningSecret: '',
-        slackBotToken: '',
-        currentBotType: '',
-      });
-      toastSuccess('success');
-    }
-    catch (err) {
-      toastError(err);
-    }
-  };
-
 
   const changeCurrentBotSettingsHandler = async() => {
     try {