Commit 5a143dbe authored by Deni Rinaldi's avatar Deni Rinaldi

download template BU

parent 586128e4
......@@ -132,6 +132,21 @@ export default class UnitBisnis extends Component {
})
}
downloadFile = async () => {
let res = await fetch(
"https://trftia.eksad.com/tia-reporting-dev/public/attachment/download_file?fileName=BusinessUnitTemplate&&fileType=xlsx"
)
res = await res.blob()
console.log(res)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Template Business Unit.xlsx';
a.click();
}
}
render() {
const columns = [{
name: "Action",
......@@ -216,7 +231,16 @@ export default class UnitBisnis extends Component {
{/* <input type="text" value={this.state.search} onChange={(e)=> this.setState({ search: e.target.value})} style={{ width: '100%'}} /> */}
</div>
<div style={{ width: '30%', justifyContent: 'space-around', display: 'flex', flexFlow: 'wrap' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent'
}}
onClick={() => this.downloadFile()}
>
<img src={Images.template} />
</button>
<button
style={{
backgroundColor: 'transparent',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment