diff --git a/src/main/account.js b/src/main/account.js index c9358e84..2a4a7135 100644 --- a/src/main/account.js +++ b/src/main/account.js @@ -5,15 +5,12 @@ export default class Account { this.db = db } - listInstances () { + listAccounts () { return new Promise((resolve, reject) => { - this.db.find({accessToken: { $ne: '' }}, (err, doc) => { + this.db.find({accessToken: { $ne: '' }}, (err, docs) => { if (err) return reject(err) - if (empty(doc)) return reject(new EmptyRecordError('empty')) - const instances = doc.map((e, i, array) => { - return { baseURL: e.baseURL, id: e._id } - }) - resolve(instances) + if (empty(docs)) return reject(new EmptyRecordError('empty')) + resolve(docs) }) }) } @@ -29,7 +26,7 @@ export default class Account { if (empty(doc)) return reject(new EmptyRecordError('empty')) const instance = { baseURL: doc.baseURL, - id: doc.id + id: doc._id } resolve(instance) } diff --git a/src/main/index.js b/src/main/index.js index b68a02b5..acbc5f8d 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -102,15 +102,15 @@ ipcMain.on('get-social-token', (event, _) => { }) // nedb -ipcMain.on('list-instances', (event, _) => { +ipcMain.on('list-accounts', (event, _) => { const account = new Account(db) - account.listInstances() + account.listAccounts() .catch((err) => { console.error(err) - event.sender.send('error-list-instances', err) + event.sender.send('error-list-accounts', err) }) - .then((instances) => { - event.sender.send('response-list-instances', instances) + .then((accounts) => { + event.sender.send('response-list-accounts', accounts) }) }) diff --git a/src/renderer/components/GlobalHeader.vue b/src/renderer/components/GlobalHeader.vue index 9f88f769..32c1baed 100644 --- a/src/renderer/components/GlobalHeader.vue +++ b/src/renderer/components/GlobalHeader.vue @@ -2,17 +2,17 @@