Skip to content

Commit

Permalink
lib/cache: Fix save of isOnline var if false
Browse files Browse the repository at this point in the history
  • Loading branch information
sogehige committed Apr 3, 2018
1 parent d8a4170 commit d78ce01
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/cache.js
Expand Up @@ -69,7 +69,7 @@ class Cache {

// attribute
async isOnline (value) {
if (value) {
if (!_.isNil(value)) {
// setter
await global.db.engine.update('cache', { key: 'isOnline' }, {
value: value
Expand All @@ -78,7 +78,7 @@ class Cache {
} else {
// getter
let cache = await global.db.engine.findOne('cache', { key: 'isOnline' })
return _.get(cache, 'value', null)
return _.get(cache, 'value', false)
}
}

Expand Down

0 comments on commit d78ce01

Please sign in to comment.