Просмотр исходного кода

add put action in handleBotTypeSelect

zahmis 4 лет назад
Родитель
Сommit
115a61ecc4
1 измененных файлов с 12 добавлено и 1 удалено
  1. 12 1
      src/client/js/components/Admin/SlackIntegration/SlackIntegration.jsx

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

@@ -78,14 +78,25 @@ const SlackIntegration = (props) => {
     fetchSlackIntegrationData();
     fetchSlackIntegrationData();
   }, [fetchSlackIntegrationData]);
   }, [fetchSlackIntegrationData]);
 
 
-  const handleBotTypeSelect = (clickedBotType) => {
+  const handleBotTypeSelect = async(clickedBotType) => {
+    console.log('handleBot');
     if (clickedBotType === currentBotType) {
     if (clickedBotType === currentBotType) {
       return;
       return;
     }
     }
     if (currentBotType === null) {
     if (currentBotType === null) {
+      try {
+        await appContainer.apiv3.put('/slack-integration-settings/bot-type', {
+          currentBotType: clickedBotType,
+        });
+      }
+      catch (error) {
+        console.log(error);
+      }
       setCurrentBotType(clickedBotType);
       setCurrentBotType(clickedBotType);
+
       return;
       return;
     }
     }
+
     setSelectedBotType(clickedBotType);
     setSelectedBotType(clickedBotType);
   };
   };