refactor buy init function

This commit is contained in:
Gabriel Bazán 2016-08-04 13:54:31 -03:00 committed by Gustavo Maximiliano Cortez
parent 98c59b611b
commit da4d8274ff
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
1 changed files with 12 additions and 7 deletions

View File

@ -19,13 +19,18 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
amazonService.setCredentials(network);
self.allWallets = profileService.getWallets(network, 1);
client = profileService.focusedClient;
if (client && client.credentials.m == 1 && client.credentials.network == network) {
$timeout(function() {
self.selectedWalletId = client.credentials.walletId;
self.selectedWalletName = client.credentials.walletName;
$scope.$apply();
}, 100);
}
if (!client) return;
if (lodash.isEmpty(self.allWallets)) return;
if (client.credentials.network != network) return;
$timeout(function() {
self.selectedWalletId = client.credentials.walletId;
self.selectedWalletName = client.credentials.walletName;
$scope.$apply();
}, 100);
};
$scope.openWalletsModal = function(wallets) {