Refactored to use loadAccounts
This commit is contained in:
parent
93b6c0e086
commit
fcfe16d5eb
1 changed files with 2 additions and 11 deletions
|
|
@ -54,17 +54,8 @@ function loadAccounts (schemaVersion) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function showAccounts (schemaVersion) {
|
function showAccounts (schemaVersion) {
|
||||||
const sql = `select data
|
return loadAccounts(schemaVersion)
|
||||||
from user_config
|
.then(accounts => {
|
||||||
where type=$1
|
|
||||||
and schema_version=$2
|
|
||||||
and valid
|
|
||||||
order by id desc
|
|
||||||
limit 1`
|
|
||||||
|
|
||||||
return db.oneOrNone(sql, ['accounts', schemaVersion || NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
|
||||||
.then(res => {
|
|
||||||
const accounts = _.compose(_.defaultTo({}), _.get('data.accounts'))(res)
|
|
||||||
const filledSecretPaths = _.compact(_.map(path => {
|
const filledSecretPaths = _.compact(_.map(path => {
|
||||||
if (!_.isEmpty(_.get(path, accounts))) {
|
if (!_.isEmpty(_.get(path, accounts))) {
|
||||||
return path
|
return path
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue