2
0
mirror of https://github.com/frappe/books.git synced 2025-01-23 15:18:24 +00:00

fix how the download path is calculated

This commit is contained in:
Ankit Singhaniya 2021-08-18 23:27:06 +05:30 committed by 18alantom
parent 17d607ef14
commit 11e3474e8d

View File

@ -90,24 +90,21 @@ export default {
let html = this.$refs.printContainer.innerHTML; let html = this.$refs.printContainer.innerHTML;
makePDF(html, destination); makePDF(html, destination);
}, },
getSavePath() { async getSavePath() {
return new Promise(resolve => { const options = {
remote.dialog.showSaveDialog( title: this._('Select folder'),
remote.getCurrentWindow(), defaultPath: `${this.name}.pdf`
{ };
title: this._('Select folder'),
defaultPath: `${this.name}.pdf` let { filePath } = await remote.dialog.showSaveDialog(options);
}, console.log(filePath);
filePath => { if (filePath) {
if (filePath) { if (!filePath.endsWith('.pdf')) {
if (!filePath.endsWith('.pdf')) { filePath = filePath + '.pdf';
filePath = filePath + '.pdf'; }
} }
resolve(filePath);
} return filePath;
}
);
});
} }
} }
}; };