fix: save only new accounts info
This commit is contained in:
parent
54a19b25c1
commit
a8fbb57bf6
1 changed files with 3 additions and 1 deletions
|
|
@ -24,7 +24,9 @@ select $1, $2, $3, $4 where $1 not in (select type from user_config)`
|
|||
function saveAccounts (accountsToSave) {
|
||||
return loadAccounts()
|
||||
.then(currentAccounts => {
|
||||
const newAccounts = _.assign(currentAccounts, accountsToSave)
|
||||
const serviceCode = _.keys(accountsToSave)[0]
|
||||
accountsToSave[serviceCode] = _.omitBy(_.isEmpty, accountsToSave[serviceCode])
|
||||
const newAccounts = _.merge(currentAccounts, accountsToSave)
|
||||
return db.none(accountsSql, ['accounts', { accounts: newAccounts }, true, NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue