mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2024-12-12 00:45:19 +01:00
refs #274 Update icon when user add a new account
This commit is contained in:
parent
ac3e2241d9
commit
fbc8d814cd
@ -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
Block a user