Skip to content

Commit

Permalink
fix(watcher): supported remove watcher for ent (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
maira-samtek authored Aug 8, 2024
1 parent bcf5083 commit da390ab
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/libs/jira-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,24 @@ export class Jira {
const axiosHeader = {
Authorization: "",
};
let params = {
username: undefined,
accountId: undefined,
};
if (process.env.JIRA_HOST?.includes("jiraent")) {
axiosHeader["Authorization"] = `Bearer ${process.env.JIRA_TOKEN}`;
params["username"] = currentUser.name;
} else {
axiosHeader["Authorization"] = `Basic ${Buffer.from(
`${process.env.JIRA_USERNAME}:${process.env.JIRA_TOKEN}`
).toString("base64")}`;
params["accountId"] = currentUser.accountId;
}
await axios({
method: "DELETE",
url: `https://${process.env.JIRA_HOST}/rest/api/3/issue/${issueKey}/watchers`,
headers: axiosHeader,
params: {
accountId: currentUser.accountId,
},
params,
});
} catch (err) {
console.error("Error creating issue or removing watcher:", err);
Expand Down

0 comments on commit da390ab

Please sign in to comment.