better status while incomplete
This commit is contained in:
parent
017305f217
commit
c4d97243e1
|
@ -85,13 +85,24 @@ API.prototype._tryToComplete = function(data, cb) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
API.prototype._loadAndCheck = function(cb) {
|
|
||||||
|
API.prototype._load = function(cb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.storage.load(function(err, data) {
|
this.storage.load(function(err, data) {
|
||||||
if (err || !data) {
|
if (err || !data) {
|
||||||
return cb(err || 'Wallet file not found.');
|
return cb(err || 'Wallet file not found.');
|
||||||
}
|
}
|
||||||
|
return cb(null, data);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
API.prototype._loadAndCheck = function(cb) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
this._load(function(err, data) {
|
||||||
|
if (err) return cb(err);
|
||||||
if (data.n > 1) {
|
if (data.n > 1) {
|
||||||
var pkrComplete = data.publicKeyRing && data.m && data.publicKeyRing.length === data.n;
|
var pkrComplete = data.publicKeyRing && data.m && data.publicKeyRing.length === data.n;
|
||||||
|
|
||||||
|
@ -274,7 +285,7 @@ API.prototype.joinWallet = function(secret, copayerName, cb) {
|
||||||
API.prototype.getStatus = function(cb) {
|
API.prototype.getStatus = function(cb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this._loadAndCheck(function(err, data) {
|
this._load(function(err, data) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
|
|
||||||
var url = '/v1/wallets/';
|
var url = '/v1/wallets/';
|
||||||
|
|
Loading…
Reference in New Issue