diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index e2d85d1ce..a1794bbfe 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -24,18 +24,19 @@ angular.module('copayApp.services') $log.debug('Set focus:', walletId); // Set local object - root.focusedClient = root.walletClients[walletId]; + if (walletId) + root.focusedClient = root.walletClients[walletId]; + else + root.focusedClient = []; if (lodash.isEmpty(root.focusedClient)) { root.focusedClient = root.walletClients[lodash.keys(root.walletClients)[0]]; } + // Still nothing? if (lodash.isEmpty(root.focusedClient)) { $rootScope.$emit('Local/NoWallets'); - } - - // set if completed - if (!lodash.isEmpty(root.focusedClient)) { + } else { $rootScope.$emit('Local/NewFocusedWallet'); } diff --git a/src/js/services/storageService.js b/src/js/services/storageService.js index 47b213ae2..f53bfd064 100644 --- a/src/js/services/storageService.js +++ b/src/js/services/storageService.js @@ -124,7 +124,7 @@ angular.module('copayApp.services') }; root.storeFocusedWalletId = function(id, cb) { - storage.set('focusedWalletId', id, cb); + storage.set('focusedWalletId', id||'', cb); }; root.getFocusedWalletId = function(cb) {