1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix context admin api for empty contexts

This commit is contained in:
Nick O'Leary 2018-07-03 21:18:43 +01:00
parent 9bbe405cd0
commit 4e4a1f11e6
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -50,15 +50,19 @@ module.exports = {
ctx.keys(function(err, keys) { ctx.keys(function(err, keys) {
var result = {}; var result = {};
var c = keys.length; var c = keys.length;
keys.forEach(function(key) { if (c === 0) {
ctx.get(key,function(err, v) { res.json(result);
result[key] = util.encodeObject({msg:v}); } else {
c--; keys.forEach(function(key) {
if (c === 0) { ctx.get(key,function(err, v) {
res.json(result); result[key] = util.encodeObject({msg:v});
} c--;
if (c === 0) {
res.json(result);
}
});
}); });
}); }
}); });
} }
} else { } else {