tiagobento commented on code in PR #2126:
URL: 
https://github.com/apache/incubator-kie-tools/pull/2126#discussion_r1467835390


##########
packages/chrome-extension/src/app/components/common/GitHubContext.tsx:
##########
@@ -53,6 +53,20 @@ export function getCookie(name: string) {
   }
 }
 
+export function getGitHubApiBaseUrl(baseUrl: string) {
+  let apiBaseUrl;
+  if (baseUrl.indexOf("https://";) === 0) {
+    apiBaseUrl = "https://api."; + baseUrl.slice(8);
+  } else if (baseUrl.indexOf("http://";) === 0) {
+    apiBaseUrl = "http://api."; + baseUrl.slice(7);
+  } else {
+    console.error("Not supported protocol");
+    return;
+  }
+
+  return apiBaseUrl;
+}

Review Comment:
   ```suggestion
   export function getGitHubApiBaseUrl(baseUrl: string) {
     if (baseUrl.startsWith("https://";)) {
       return "https://api."; + baseUrl.slice(8);
     } else if (baseUrl.startsWith("http://";)) {
       return "http://api."; + baseUrl.slice(7);
     } else {
       console.error(`Unsupported protocol for GitHub API base URL: 
${baseUrl}`);
       return;
     }
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to