improve dashboard reload (#327)

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen authored and GitHub committed 2020-04-30 16:52:04 +03:00
1 parent 3066576382
commit 0f708c7fc5
2 files changed
+10 -4

No files matched your search

+7 -2
View File
@@ -145,8 +145,13 @@ export default function initMenu(opts: MenuOptions, promiseIpc: any) {
webContents.getFocusedWebContents().executeJavaScript('window.history.forward()')
}
},
{ role: 'reload' },
{ role: 'forceReload' },
{
label: 'Reload',
accelerator: 'CmdOrCtrl+R',
click () {
webContents.getFocusedWebContents().reload()
}
},
...(isDevelopment ? [
{ role: 'toggleDevTools'} as MenuItemConstructorOptions,
{
+3 -2
View File
@@ -92,13 +92,14 @@ export class Router {
const asset = path.join(assetsPath, file)
readFile(asset, (err, data) => {
if (err) {
response.statusCode = 404
// default to index.html so that react routes work when page is refreshed
this.handleStaticFile("index.html", response)
} else {
const type = mimeTypes[path.extname(asset).slice(1)] || "text/plain";
response.setHeader("Content-Type", type);
response.write(data)
response.end()
}
response.end()
})
}