Skip to content

Commit

Permalink
Add debug menu item to delete swap history (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus authored and lukechilds committed Jun 12, 2018
1 parent 991c988 commit 0d40526
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,21 @@ const createDebugMenu = () => {
{
type: 'separator',
},
{
label: 'Delete Swap History',
async click() {
const [win] = BrowserWindow.getAllWindows();
await runJS('_swapDB.destroy()', win);
app.relaunch();
app.quit();
},
},
{
label: 'Delete Portfolios',
click() {
const [win] = BrowserWindow.getAllWindows();
shell.moveItemToTrash(path.join(app.getPath('userData'), 'portfolios'));
BrowserWindow.getAllWindows()[0].webContents.reload();
win.webContents.reload();
},
},
{
Expand Down
4 changes: 4 additions & 0 deletions app/renderer/swap-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ class SwapDB {

return swapData.map(this._formatSwap);
}

async destroy() {
await this.db.destroy();
}
}

export default SwapDB;

0 comments on commit 0d40526

Please sign in to comment.