mirror of https://github.com/xwiki-labs/cryptpad
handle return of undefined hash
This commit is contained in:
parent
1d933be5a6
commit
f82278a25c
|
@ -25,13 +25,13 @@ define([
|
||||||
exp.send = rpc.send;
|
exp.send = rpc.send;
|
||||||
|
|
||||||
// you can ask the server to pin a particular channel for you
|
// you can ask the server to pin a particular channel for you
|
||||||
exp.pin = function (channel, cb) {
|
exp.pin = function (channels, cb) {
|
||||||
rpc.send('PIN', channel, cb);
|
rpc.send('PIN', channels, cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
// you can also ask to unpin a particular channel
|
// you can also ask to unpin a particular channel
|
||||||
exp.unpin = function (channel, cb) {
|
exp.unpin = function (channels, cb) {
|
||||||
rpc.send('UNPIN', channel, cb);
|
rpc.send('UNPIN', channels, cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
// This implementation must match that on the server
|
// This implementation must match that on the server
|
||||||
|
@ -44,6 +44,9 @@ define([
|
||||||
// ask the server what it thinks your hash is
|
// ask the server what it thinks your hash is
|
||||||
exp.getServerHash = function (cb) {
|
exp.getServerHash = function (cb) {
|
||||||
rpc.send('GET_HASH', edPublic, function (e, hash) {
|
rpc.send('GET_HASH', edPublic, function (e, hash) {
|
||||||
|
if (!(hash && hash[0])) {
|
||||||
|
return void cb('NO_HASH_RETURNED');
|
||||||
|
}
|
||||||
cb(e, hash[0]);
|
cb(e, hash[0]);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue