From 2fbb6f4c9a06fb2e44748f9014b561894ca407df Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 18 May 2015 10:30:09 -0300 Subject: [PATCH] fix delete wallet in fileStorage --- src/js/services/profileService.js | 11 ++++++----- src/js/services/storageService.js | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) 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) {