소스 검색

use forEach

zahmis 5 년 전
부모
커밋
bef678102c
1개의 변경된 파일6개의 추가작업 그리고 4개의 파일을 삭제
  1. 6 4
      src/client/js/components/Admin/SlackIntegration/CustomBotWithProxyIntegrationCard.jsx

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

@@ -7,12 +7,14 @@ const CustomBotWithProxyIntegrationCard = (props) => {
   const { workspaceNames } = props;
 
   let errorCount = 0;
-  for (let i = 0; i < workspaceNames.length; ++i) {
-    if (workspaceNames[i] == null) { errorCount++ }
-  }
+  workspaceNames.forEach((w) => {
+    if (w == null) {
+      errorCount++;
+    }
+  });
 
   let conductionStatus;
-  if (errorCount === 0) {
+  if (errorCount === 0 && workspaceNames.length !== 0) {
     conductionStatus = 'green';
   }
   else if (errorCount === workspaceNames.length) {