Display a message for users whose have wallet:: but not profile::
This commit is contained in:
parent
bfdfc68d83
commit
2c07ad6dd7
7 changed files with 94 additions and 8 deletions
|
|
@ -78,9 +78,13 @@ InsightStorage.prototype.clear = function(callback) {
|
|||
};
|
||||
|
||||
InsightStorage.prototype.allKeys = function(callback) {
|
||||
// NOOP
|
||||
// TODO: Add functionality?
|
||||
callback();
|
||||
// TODO: compatibility with localStorage
|
||||
return callback(null);
|
||||
};
|
||||
|
||||
InsightStorage.prototype.getFirst = function(prefix, opts, callback) {
|
||||
// TODO: compatibility with localStorage
|
||||
return callback(null, true, true);
|
||||
};
|
||||
|
||||
module.exports = InsightStorage;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
'use strict';
|
||||
var _ = require('lodash');
|
||||
|
||||
function LocalStorage() {
|
||||
this.type = 'DB';
|
||||
|
|
@ -51,4 +52,28 @@ LocalStorage.prototype.allKeys = function(cb) {
|
|||
return cb(null, ret);
|
||||
};
|
||||
|
||||
LocalStorage.prototype.getFirst = function(prefix, opts, cb) {
|
||||
opts = opts || {};
|
||||
var that = this;
|
||||
|
||||
this.allKeys(function(err, allKeys) {
|
||||
var keys = _.filter(allKeys, function(k) {
|
||||
if ((k === prefix) || k.indexOf(prefix) === 0) return true;
|
||||
});
|
||||
|
||||
if (keys.length === 0)
|
||||
return cb(new Error('not found'));
|
||||
|
||||
if (opts.onlyKey)
|
||||
return cb(null, null, keys[0]);
|
||||
|
||||
that.getItem(keys[0], function(err, data) {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
return cb(null, data, keys[0]);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = LocalStorage;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue