That is more like a javascript question if everything else is working OK. I have some legacy that does something similar. It looks like you don't have a callback, the 'thens'.
You could probably adapt that ?
function downloadstudy_orthanc(type, clicked) {
$("#spinner").css("display", "block");
fetch('/OrthancDev/downloadStudyUUID', {
body: JSON.stringify({command: type, "uuid": clicked.data( "uuid")}),
method: 'POST',
headers: {
'Content-Type': 'application/json; charset=utf-8',
'csrf-token' : $("meta[name='csrf-token']").attr("content")
},
})
.then(response => response.blob())
.then(response => {
$("#spinner").css("display", "none");
const blob = new Blob([response], {type: 'application/zip'});
const downloadUrl = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = downloadUrl;
a.download = clicked.data("name") + ".zip";
document.body.appendChild(a);
a.click();
showMessage("Download Study", "Check you Downloads Folder");
})
}
/sds