close #931 Fixed: Bulk action delete not working

This commit is contained in:
Cüneyt Şentürk
2019-11-22 16:48:44 +03:00
parent 346c208e63
commit 03e2079b2c
12 changed files with 57 additions and 14 deletions

View File

@ -80,14 +80,41 @@ export default class BulkAction {
.then(response => {
//this.loading = false;
//this.modal = false;
if (response.data.redirect) {
window.location.reload(false);
} else {
this.loading = false;
this.modal = false;
window.location.reload(false);
// It is necessary to create a new blob object with mime-type explicitly set
// otherwise only Chrome works like it should
var newBlob = new Blob([response.body], {type: 'application/pdf'})
// IE doesn't allow using a blob object directly as link href
// instead it is necessary to use msSaveOrOpenBlob
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(newBlob)
return
}
// For other browsers:
// Create a link pointing to the ObjectURL containing the blob.
const data = window.URL.createObjectURL(newBlob)
var link = document.createElement('a')
link.href = data
link.download = filename + '.pdf'
link.click()
setTimeout(function () {
// For Firefox it is necessary to delay revoking the ObjectURL
window.URL.revokeObjectURL(data)
}, 100)
}
})
.catch(error => {
//this.loading = false;
//this.modal = false;
window.location.reload(false);
//window.location.reload(false);
});
}