Skip to content

Instantly share code, notes, and snippets.

@tonysaffo
Created December 20, 2018 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonysaffo/652c99ae0cac9daa4a3e68ae104f5fa5 to your computer and use it in GitHub Desktop.
Save tonysaffo/652c99ae0cac9daa4a3e68ae104f5fa5 to your computer and use it in GitHub Desktop.
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