handle return of undefined hash

This commit is contained in:
ansuz 2017-04-10 17:38:25 +02:00
parent 1d933be5a6
commit f82278a25c
1 changed files with 7 additions and 4 deletions

View File

@ -25,13 +25,13 @@ define([
exp.send = rpc.send;
// you can ask the server to pin a particular channel for you
exp.pin = function (channel, cb) {
rpc.send('PIN', channel, cb);
exp.pin = function (channels, cb) {
rpc.send('PIN', channels, cb);
};
// you can also ask to unpin a particular channel
exp.unpin = function (channel, cb) {
rpc.send('UNPIN', channel, cb);
exp.unpin = function (channels, cb) {
rpc.send('UNPIN', channels, cb);
};
// This implementation must match that on the server
@ -44,6 +44,9 @@ define([
// ask the server what it thinks your hash is
exp.getServerHash = function (cb) {
rpc.send('GET_HASH', edPublic, function (e, hash) {
if (!(hash && hash[0])) {
return void cb('NO_HASH_RETURNED');
}
cb(e, hash[0]);
});
};