This commit is contained in:
Josh Harvey 2016-11-19 02:13:06 +02:00
parent 0aa457680c
commit 47db8e9ead
7 changed files with 136 additions and 114 deletions

View file

@ -12,8 +12,9 @@ function loadAccounts () {
const toFields = fieldArr => R.fromPairs(R.map(r => [r.code, r.value], fieldArr))
const toPairs = r => [r.code, toFields(r.fields)]
return db.one('select data from user_config where type=$1', 'accounts')
return db.oneOrNone('select data from user_config where type=$1', 'accounts')
.then(function (data) {
if (!data) return {}
return R.fromPairs(R.map(toPairs, data.data.accounts))
})
}