This commit is contained in:
Josh Harvey 2016-11-27 18:12:49 +02:00
parent 3a99b7a6bc
commit 00d986376e
8 changed files with 149 additions and 155 deletions

View file

@ -2,8 +2,7 @@ const R = require('ramda')
const db = require('./db')
// Note: We won't prematurely optimize by caching yet
// This shouldn't really affect performance at these scales
let settings
function load () {
return Promise.all([
@ -11,10 +10,16 @@ function load () {
loadAccounts()
])
.then(function ([data, accounts]) {
return {
settings = {
config: data.data,
accounts: accounts
}
return settings
})
.catch(err => {
settings = undefined
throw err
})
}
@ -29,15 +34,7 @@ function loadAccounts () {
})
}
function settings () {
return load()
}
function clear () {
// Do nothing, since no caching
}
module.exports = {
settings,
clear
load
}