get limits from the server
This commit is contained in:
parent
591c5a7844
commit
2dd04f7631
@ -743,13 +743,20 @@ define([
|
|||||||
|
|
||||||
common.updatePinLimit = function (cb) {
|
common.updatePinLimit = function (cb) {
|
||||||
if (!pinsReady()) { return void cb('[RPC_NOT_READY]'); }
|
if (!pinsReady()) { return void cb('[RPC_NOT_READY]'); }
|
||||||
rpc.updatePinLimits(cb);
|
rpc.updatePinLimits(function (e, limit) {
|
||||||
|
if (e) { return cb(e); }
|
||||||
|
var MB = common.bytesToMegabytes(limit);
|
||||||
|
cb(e, MB);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
common.getPinLimit = function (cb) {
|
common.getPinLimit = function (cb) {
|
||||||
if (!pinsReady()) { return void cb('[RPC_NOT_READY]'); }
|
if (!pinsReady()) { return void cb('[RPC_NOT_READY]'); }
|
||||||
cb(void 0, typeof(AppConfig.pinLimit) === 'number'? AppConfig.pinLimit: 1000);
|
rpc.getLimit(function (e, limit) {
|
||||||
//rpc.getLimit(cb); TODO
|
if (e) { return cb(e); }
|
||||||
|
var MB = common.bytesToMegabytes(limit);
|
||||||
|
cb(void 0, MB);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
common.isOverPinLimit = function (cb) {
|
common.isOverPinLimit = function (cb) {
|
||||||
|
|||||||
@ -125,7 +125,7 @@ define([
|
|||||||
exp.updatePinLimits = function (cb) {
|
exp.updatePinLimits = function (cb) {
|
||||||
rpc.send('UPDATE_LIMITS', undefined, function (e, response) {
|
rpc.send('UPDATE_LIMITS', undefined, function (e, response) {
|
||||||
if (e) { return void cb(e); }
|
if (e) { return void cb(e); }
|
||||||
if (response && typeof response === "number") {
|
if (response && response.length && typeof(response[0]) === "number") {
|
||||||
cb (void 0, response);
|
cb (void 0, response);
|
||||||
} else {
|
} else {
|
||||||
cb('INVALID_RESPONSE');
|
cb('INVALID_RESPONSE');
|
||||||
@ -136,8 +136,8 @@ define([
|
|||||||
exp.getLimit = function (cb) {
|
exp.getLimit = function (cb) {
|
||||||
rpc.send('GET_LIMIT', undefined, function (e, response) {
|
rpc.send('GET_LIMIT', undefined, function (e, response) {
|
||||||
if (e) { return void cb(e); }
|
if (e) { return void cb(e); }
|
||||||
if (response && typeof response === "number") {
|
if (response && response.length && typeof(response[0]) === "number") {
|
||||||
cb (void 0, response);
|
cb (void 0, response[0]);
|
||||||
} else {
|
} else {
|
||||||
cb('INVALID_RESPONSE');
|
cb('INVALID_RESPONSE');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user