Skip to content

Commit

Permalink
Merge pull request #46 from devgateway/fix/OCVN-231/firefox-excel-export
Browse files Browse the repository at this point in the history
Fix/ocvn 231/firefox excel export
  • Loading branch information
alexeisavca authored Jul 28, 2016
2 parents 26f5484 + bb8c03a commit 75f657f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ui/oce/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,18 @@ export default class OCApp extends React.Component{

downloadExcel(){
this.setState({exporting: true});
let url = new URI('/api/ocds/excelExport').addSearch(this.state.filters.toJS()).addSearch('year', this.state.selectedYears.toArray());
fetch(url.clone().query(""), {
let url = new URI('/api/ocds/excelExport').addSearch(this.state.filters.toJS()).addSearch('year', this.state.selectedYears.toArray());
fetch(url.clone().query(""), {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
'Content-Type': 'application/x-www-form-urlencoded'
},
body: url.query()
body: url.query()
}).then(callFunc('blob')).then(blob => {
var link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = "excel-export.xlsx";
link.download = "excel-export.xlsx";
document.body.appendChild(link);
link.click();
this.setState({exporting: false})
}).catch((...args) => {
Expand Down

0 comments on commit 75f657f

Please sign in to comment.