Fix first link to your account. Removes unused variables. Fix spinner

This commit is contained in:
Gustavo Maximiliano Cortez 2017-01-18 11:58:30 -03:00
commit 8b0919f2dc
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
5 changed files with 32 additions and 32 deletions

View file

@ -16,6 +16,8 @@ angular.module('copayApp.controllers').controller('coinbaseController', function
$scope.loading = false;
if (err || lodash.isEmpty(data)) {
if (err) {
$log.error(err);
err = err.errors ? err.errors[0].message : err;
popupService.showAlert('Error', err);
}
return;
@ -79,18 +81,15 @@ angular.module('copayApp.controllers').controller('coinbaseController', function
this.submitOauthCode = function(code) {
var self = this;
ongoingProcess.set('connectingCoinbase', true);
$scope.error = null;
$timeout(function() {
coinbaseService.getToken(code, function(err, accessToken) {
ongoingProcess.set('connectingCoinbase', false);
if (err) {
popupService.showAlert('Error', err);
return;
}
$scope.accessToken = accessToken;
init();
});
}, 100);
coinbaseService.getToken(code, function(err, accessToken) {
ongoingProcess.set('connectingCoinbase', false);
if (err) {
popupService.showAlert('Error', err);
return;
}
$scope.accessToken = accessToken;
init();
});
};
this.openTxModal = function(tx) {
@ -109,7 +108,9 @@ angular.module('copayApp.controllers').controller('coinbaseController', function
$scope.$on("$ionicView.beforeEnter", function(event, data) {
coinbaseService.setCredentials();
if (data.stateParams && data.stateParams.code) {
self.submitOauthCode(data.stateParams.code);
coinbaseService.getStoredToken(function(at) {
if (!at) self.submitOauthCode(data.stateParams.code);
});
} else {
init();
}