Skip to content

Commit

Permalink
fix invoice to pdf filename
Browse files Browse the repository at this point in the history
  • Loading branch information
madisvain committed Sep 26, 2020
1 parent ce2047a commit 765f712
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/main/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { app, BrowserWindow, ipcMain, shell, dialog } from 'electron';
import { app, BrowserWindow, ipcMain, dialog } from 'electron';
import { autoUpdater } from 'electron-updater';
import * as path from 'path';
import * as url from 'url';
Expand Down Expand Up @@ -113,7 +113,8 @@ ipcMain.on('readyToPrint', (event, filename) => {
if (error) {
event.sender.send('wrotePDF');
}
shell.openItem(filePath);
// TODO: Causes an exception on OSX
// shell.openItem(filePath);
event.sender.send('wrotePDF');
});
})
Expand Down
11 changes: 5 additions & 6 deletions src/pages/invoices/$id/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,12 @@ class Invoice extends Component {
if (get(this.props, ['match', 'path'], '').endsWith('pdf')) {
const { ipcRenderer } = window.require('electron');

const { invoices } = this.props;
const invoice = get(invoices.items, get(this.props, ['match', 'params', 'id']));
setTimeout(() => {
const { invoices } = this.props;
const invoice = get(invoices.items, get(this.props, ['match', 'params', 'id']));

setTimeout(
() => ipcRenderer.send('readyToPrint', `Invoice ${get(invoice, 'number')}.pdf`),
200
);
ipcRenderer.send('readyToPrint', `Invoice ${get(invoice, 'number')}.pdf`);
}, 200);
}
}

Expand Down

0 comments on commit 765f712

Please sign in to comment.