Created
December 20, 2018 17:06
-
-
Save tonysaffo/652c99ae0cac9daa4a3e68ae104f5fa5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
downloadHt = (e) => { | |
const { token, setToken, taskId } = this.props | |
const el = e.target | |
this.ApiService.downloadHt(token, setToken, taskId, this.state.export) | |
.then(r => { | |
if(r === 'error'){ | |
el.innerHTML = 'Произошла ошибка' | |
setTimeout(() => { | |
el.innerHTML = 'Распечатать' | |
return | |
}, 1000); | |
} else { | |
console.log('--------r.url', r) | |
//window.open(`https://${r.url}`) | |
//window.open(`https://${r.url}`,'_blank'); | |
//fileDownload(`https://${r.url}`, 'filename.pdf'); | |
const url = `https://${r.url}`; | |
const link = document.createElement('a'); | |
link.href = url; | |
link.setAttribute('target', '_blank'); | |
document.body.appendChild(link); | |
link.click(); | |
} | |
}) | |
//console.log('------data export', this.state.export) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment