fix displaying errors

This commit is contained in:
Javier 2016-08-04 17:12:41 -03:00
commit d6c25896f7

View file

@ -25,29 +25,36 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
$scope.sign = function(txp) {
$scope.error = null;
var prefix = fc.credentials.m > 1 ? gettextCatalog.getString('Could not create payment proposal') : gettextCatalog.getString('Could not send payment');
$scope.loading = 'Signing Transaction';
$timeout(function() {
fingerprintService.check(fc, function(err) {
if (err) {
$scope.error = bwcError.msg(err);
$scope.loading = null;
$scope.error = prefix;
$timeout(function() {
$scope.$digest();
}, 1);
return;
}
handleEncryptedWallet(function(err) {
if (err) {
$scope.error = bwcError.msg(err);
$scope.loading = null;
$scope.error = bwcError.msg(err, prefix);
$timeout(function() {
$scope.$digest();
}, 1);
return;
}
walletService.signTx(fc, txp, function(err, signedTxp) {
walletService.lock(fc);
if (err) {
$scope.error = bwcError.msg(err);
$scope.loading = null;
$scope.error = bwcError.msg(err, prefix);
$timeout(function() {
$scope.$digest();
}, 1);
return;
}
@ -59,6 +66,9 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
$scope.close(broadcastedTxp);
if (err) {
$scope.error = err;
$timeout(function() {
$scope.$digest();
}, 1);
}
});
} else {
@ -69,9 +79,12 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
});
});
});
}, 10);
};
$scope.$on('$destroy', function() {
walletService.lock(fc);
});
$scope.reject = function(txp) {
$scope.loading = 'Rejecting payment';
$scope.error = null;