update download att
This commit is contained in:
parent
527028bc58
commit
0f2b655a17
@ -278,9 +278,9 @@ export default {
|
|||||||
this.mnx_backendErrorHandler(error)
|
this.mnx_backendErrorHandler(error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
downloadAttachedFile(request_id, document_id) {
|
downloadAttachedFile(request_id, document_id, file_name) {
|
||||||
|
|
||||||
window.open(`http://${window.location.host}/api/workspace/request/fetch-attached-file-as-download?request_id=${request_id}&document_id=${document_id}`)
|
// window.open(`http://${window.location.host}/api/workspace/request/fetch-attached-file-as-download?request_id=${request_id}&document_id=${document_id}`)
|
||||||
|
|
||||||
// const link = document.createElement('a')
|
// const link = document.createElement('a')
|
||||||
// link.href = `${window.location.host}/api/workspace/request/fetch-attached-file-as-download?request_id=${request_id}&document_id=${document_id}`
|
// link.href = `${window.location.host}/api/workspace/request/fetch-attached-file-as-download?request_id=${request_id}&document_id=${document_id}`
|
||||||
@ -290,26 +290,27 @@ export default {
|
|||||||
// link.click()
|
// link.click()
|
||||||
// document.body.removeChild(link)
|
// document.body.removeChild(link)
|
||||||
|
|
||||||
// WorksapceApi.fetchAttachedFileAsDownload(request_id, document_id)
|
WorksapceApi.fetchAttachedFileAsDownload(request_id, document_id)
|
||||||
// .then((response) => {
|
.then((response) => {
|
||||||
// // create file link in browser's memory
|
console.log('resposne', response)
|
||||||
|
// create file link in browser's memory
|
||||||
// const href = URL.createObjectURL(response.data)
|
// const href = URL.createObjectURL(response.data)
|
||||||
|
|
||||||
// // create "a" HTML element with href to file & click
|
// create "a" HTML element with href to file & click
|
||||||
// const link = document.createElement('a')
|
const link = document.createElement('a')
|
||||||
// link.href = href
|
link.href = response.data.download_url
|
||||||
// link.setAttribute('download', 'file.pdf') //or any other extension
|
link.download = file_name
|
||||||
// link.setAttribute('_')
|
link.target = '_blank'
|
||||||
// document.body.appendChild(link)
|
document.body.appendChild(link)
|
||||||
// link.click()
|
link.click()
|
||||||
|
|
||||||
// // clean up "a" element & remove ObjectURL
|
// clean up "a" element & remove ObjectURL
|
||||||
// document.body.removeChild(link)
|
document.body.removeChild(link)
|
||||||
// URL.revokeObjectURL(href) //TODO: navigate to the preview page
|
// URL.revokeObjectURL(href) //TODO: navigate to the preview page
|
||||||
// })
|
})
|
||||||
// .catch((error) => {
|
.catch((error) => {
|
||||||
// this.mnx_backendErrorHandler(error)
|
this.mnx_backendErrorHandler(error)
|
||||||
// })
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user