diff --git a/src/helpers/db.js b/src/helpers/db.js index db4ecf52..d8217188 100644 --- a/src/helpers/db.js +++ b/src/helpers/db.js @@ -1,7 +1,25 @@ import Store from 'electron-store' -const store = new Store({ - // encryptionKey: 'toto', -}) +export default { + accounts: () => { + const db = new Store({ + name: 'accounts', + default: { + accounts: [], + }, + }) -export default store + return { + get: db.get('accounts'), + set: accounts => db.get('accounts', accounts), + } + }, + settings: () => { + const db = new Store({ + name: 'settings', + default: {}, + }) + + return db + }, +} diff --git a/src/middlewares/db.js b/src/middlewares/db.js index caba1de8..9e69c767 100644 --- a/src/middlewares/db.js +++ b/src/middlewares/db.js @@ -13,5 +13,5 @@ export default store => next => action => { const { accounts } = getState() - db.set('accounts', accounts.accounts) + db.accounts.set(accounts.accounts) }