handle 0 wallets
This commit is contained in:
parent
22c378b080
commit
43c0eb9cb6
5 changed files with 23 additions and 23 deletions
|
|
@ -3,15 +3,15 @@
|
|||
angular.module('copayApp.controllers').controller('HomeController', function($scope, $rootScope, $location, notification, controllerUtils, pluginManager) {
|
||||
controllerUtils.redirIfLogged();
|
||||
|
||||
$scope.retreiving =true;
|
||||
$scope.retreiving = true;
|
||||
copay.Identity.anyProfile({
|
||||
pluginManager: pluginManager,
|
||||
}, function(any) {
|
||||
$scope.retreiving =false;
|
||||
$scope.retreiving = false;
|
||||
if (!any)
|
||||
$location.path('/createProfile');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$scope.openProfile = function(form) {
|
||||
if (form && form.$invalid) {
|
||||
|
|
@ -29,7 +29,7 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
|
|||
if (err && !iden) {
|
||||
console.log('Error:' + err)
|
||||
controllerUtils.onErrorDigest(
|
||||
$scope, (err.toString()||'').match('PNOTFOUND') ? 'Profile not found' : 'Unknown error');
|
||||
$scope, (err.toString() || '').match('PNOTFOUND') ? 'Profile not found' : 'Unknown error');
|
||||
} else {
|
||||
controllerUtils.bindProfile($scope, iden, firstWallet);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,9 +190,8 @@ Identity.open = function(email, password, opts, cb) {
|
|||
iden.profile = profile;
|
||||
|
||||
var wids = _.pluck(iden.listWallets(), 'id');
|
||||
|
||||
if (!wids || !wids.length)
|
||||
return new Error('Could not open any wallet from profile');
|
||||
return cb(new Error('Could not open any wallet from profile'), iden);
|
||||
|
||||
// Open All wallets from profile
|
||||
//This could be optional, or opts.onlyOpen = wid
|
||||
|
|
|
|||
|
|
@ -217,10 +217,13 @@ angular.module('copayApp.services')
|
|||
};
|
||||
|
||||
root.bindProfile = function($scope, iden, w) {
|
||||
|
||||
root.setupGlobalVariables(iden);
|
||||
root.rebindWallets($scope, iden);
|
||||
root.setFocusedWallet(w);
|
||||
if (w) {
|
||||
root.setFocusedWallet(w);
|
||||
} else {
|
||||
$location.path('/manage');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue