Skip to content

Commit e286ae9

Browse files
committed
Adapt api url for reports
1 parent 51a3f5d commit e286ae9

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

public/curation/send_report.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { retrieveComment, retrievePipeline } from "../modules/storage.js";
2+
import * as User from "/modules/user.js"
23
import { Octokit } from "https://esm.sh/@octokit/rest";
34

45

@@ -14,7 +15,7 @@ async function sendReport(){
1415
1516
${comment.comment}
1617
<table><tr>
17-
<td>${comment.value}</td><td>${json.stringify(comment.data[0])}</td>
18+
<td>${comment.value}</td><td>${JSON.stringify(comment.data[0])}</td>
1819
</tr></table>
1920
2021
`;
@@ -26,18 +27,21 @@ ${comment.comment}
2627

2728

2829
const token = localStorage.getItem("gitlab-api-token");
29-
const username = localStorage.getItem("gitlab-username");
30+
const username = User.getUsername();
31+
const platform = User.getGitPlatform();
32+
console.log(platform);
3033
var [projectId, pipelineId, jobId] = await retrievePipeline();
31-
if(token.startsWith("glpat")){
32-
issueGitlab(token, projectId, message);
33-
}else{
34+
if(platform.host == "github"){
3435
issueGithub(token, username, message);
36+
}else{
37+
issueGitlab(platform, token, projectId, message);
3538
}
3639
}
3740

38-
async function issueGitlab(token, projectId, message){
41+
async function issueGitlab(platform, token, projectId, message){
42+
console.log(platform.apiUrl);
3943
const response = await fetch(
40-
`https://codebase.helmholtz.cloud/api/v4/projects/${projectId}/issues`,
44+
`${platform.apiUrl}/projects/${projectId}/issues`,
4145
{
4246
method: "POST",
4347
headers: {

0 commit comments

Comments
 (0)