zahmis 4 years ago
parent
commit
08bce5da5a
1 changed files with 3 additions and 4 deletions
  1. 3 4
      packages/slack/src/utils/check-communicable.ts

+ 3 - 4
packages/slack/src/utils/check-communicable.ts

@@ -46,12 +46,11 @@ const testSlackApiServer = async(client: WebClient): Promise<any> => {
 const checkSlackScopes = (resultTestSlackApiServer: any) => {
 const checkSlackScopes = (resultTestSlackApiServer: any) => {
   const slackScopes = resultTestSlackApiServer.response_metadata.scopes;
   const slackScopes = resultTestSlackApiServer.response_metadata.scopes;
   const correctScopes = ['commands', 'team:read', 'chat:write'];
   const correctScopes = ['commands', 'team:read', 'chat:write'];
+  const isPassedScopeCheck = correctScopes.every(e => slackScopes.includes(e));
 
 
-  if (correctScopes.every(e => slackScopes.includes(e))) {
-    return;
+  if (!isPassedScopeCheck) {
+    throw new Error('Scope error');
   }
   }
-
-  throw new Error('Scope error');
 };
 };
 
 
 /**
 /**