Skip to content

Commit

Permalink
Pop up block fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasily Negrebetskiy committed Aug 29, 2024
1 parent 9b4383e commit dab1a53
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,14 @@ function stopLoader() {
button.disabled = false;
}

function downloadURI(uri, name) {
var link = document.createElement("a");
link.download = name;
link.href = uri;
link.click();
link.remove();
}

async function generatePDF() {
startLoader();

Expand Down Expand Up @@ -219,7 +227,7 @@ async function generatePDF() {

resp = await fetch(resourceUrl + issueId, {method: "GET"});
if (resp.ok) resp.blob().then(
blob => window.open(URL.createObjectURL(blob))
blob => downloadURI(URL.createObjectURL(blob), "issue.pdf")
);
else throw new Error("Failed to recieve PDF");
} catch {
Expand Down

0 comments on commit dab1a53

Please sign in to comment.