fix error handler for join

This commit is contained in:
Matias Alejo Garcia 2015-04-24 03:37:18 -03:00
commit 460ddfa3bc
3 changed files with 11 additions and 5 deletions

View file

@ -12,6 +12,13 @@
<div class="row" ng-show="!join.loading"> <div class="row" ng-show="!join.loading">
<div class="large-12 columns"> <div class="large-12 columns">
<div class="box-notification" ng-show="join.error ">
<span class="text-warning size-14">
{{join.error|translate}}
</span>
</div>
<form name="joinForm" ng-submit="join.join(joinForm)" novalidate> <form name="joinForm" ng-submit="join.join(joinForm)" novalidate>
<label><span translate>Your nickname</span> <label><span translate>Your nickname</span>
<div class="input"> <div class="input">

View file

@ -134,7 +134,7 @@ angular.module('copayApp.controllers').controller('joinController',
this.join = function(form) { this.join = function(form) {
if (form && form.$invalid) { if (form && form.$invalid) {
notification.error('Error', 'Please enter the required fields'); self.error = 'Please enter the required fields';
return; return;
} }
self.loading = true; self.loading = true;
@ -147,7 +147,8 @@ angular.module('copayApp.controllers').controller('joinController',
}, function(err) { }, function(err) {
self.loading = false; self.loading = false;
if (err) { if (err) {
notification.error(err); self.error = 'Could not join wallet: ' + (err.message ? err.message : err);
$rootScope.$apply();
} }
else { else {
go.walletHome(); go.walletHome();

View file

@ -151,7 +151,6 @@ angular.module('copayApp.services')
}) })
}; };
// TODO copayer name
root.createWallet = function(opts, cb) { root.createWallet = function(opts, cb) {
var walletClient = bwcService.getClient(); var walletClient = bwcService.getClient();
$log.debug('Creating Wallet:', opts); $log.debug('Creating Wallet:', opts);
@ -191,8 +190,7 @@ angular.module('copayApp.services')
} }
// TODO name // TODO name
walletClient.joinWallet(opts.secret, opts.myName || 'me', function(err) { walletClient.joinWallet(opts.secret, opts.myName || 'me', function(err) {
// TODO: err if (err) return cb(err);
if (err) return cb('Error joining wallet' + err);
root.profile.credentials.push(JSON.parse(walletClient.export())); root.profile.credentials.push(JSON.parse(walletClient.export()));
root.setWalletClients(); root.setWalletClients();