downloadImage(path) {
var filename = path.replace("storage/images/","")
var query = this.getAuthHeaders();
query["params"] = {};
query["params"] = {
path: path.replace("storage/","/app/public/"),
filename: filename
};
query["responseType"] = 'blob';
this.axios
.get(this.getApiUrlByProcess('media-analysis','get_download'), query)
.then(response => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', filename);
document.body.appendChild(link);
link.click();
})
.catch(err => {
console.error(err);
});
},
No comments:
Post a Comment