Merge pull request #310 from h3poteto/iss-274
closes #274 Update icon when user add a new account
This commit is contained in:
commit
91115d932d
|
@ -374,6 +374,12 @@ ipcMain.on('backward-account', (event, acct) => {
|
|||
ipcMain.on('refresh-accounts', (event, _) => {
|
||||
const account = new Account(accountDB)
|
||||
account.refreshAccounts()
|
||||
.then((accounts) => {
|
||||
event.sender.send('response-refresh-accounts', accounts)
|
||||
})
|
||||
.catch((err) => {
|
||||
event.sender.send('error-refresh-accounts', err)
|
||||
})
|
||||
})
|
||||
|
||||
// streaming
|
||||
|
|
|
@ -37,7 +37,18 @@ const GlobalHeader = {
|
|||
},
|
||||
// Fetch account informations and save current state when GlobalHeader is displayed
|
||||
refreshAccounts ({ commit, state }) {
|
||||
ipcRenderer.send('refresh-accounts')
|
||||
return new Promise((resolve, reject) => {
|
||||
ipcRenderer.send('refresh-accounts')
|
||||
ipcRenderer.once('error-refresh-accounts', (event, err) => {
|
||||
ipcRenderer.removeAllListeners('response-refresh-accounts')
|
||||
reject(err)
|
||||
})
|
||||
ipcRenderer.once('response-refresh-accounts', (event, accounts) => {
|
||||
ipcRenderer.removeAllListeners('error-refresh-accounts')
|
||||
commit('updateAccounts', accounts)
|
||||
resolve(accounts)
|
||||
})
|
||||
})
|
||||
},
|
||||
watchShortcutEvents ({ state, commit, rootState }) {
|
||||
ipcRenderer.on('change-account', (event, account) => {
|
||||
|
|
Loading…
Reference in New Issue