Fix glidera getting token
This commit is contained in:
parent
c6a5c77516
commit
f574a9d78b
5 changed files with 53 additions and 42 deletions
|
|
@ -65,7 +65,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
|
|||
glideraService.buy(token, twoFaCode, data, function(err, data) {
|
||||
self.loading = null;
|
||||
if (err) {
|
||||
self.error = gettext('Could not buy bitcoin');
|
||||
self.error = err;
|
||||
}
|
||||
else {
|
||||
self.success = data;
|
||||
|
|
|
|||
|
|
@ -9,17 +9,23 @@ angular.module('copayApp.controllers').controller('glideraController',
|
|||
return glideraService.getOauthCodeUrl();
|
||||
};
|
||||
|
||||
this.submitOauthCode = function(code, glideraCredentials) {
|
||||
this.submitOauthCode = function(code) {
|
||||
var fc = profileService.focusedClient;
|
||||
var self = this;
|
||||
this.loading = true;
|
||||
$timeout(function() {
|
||||
glideraService.getToken(code, glideraCredentials, function(error, data) {
|
||||
if (data && data.access_token) {
|
||||
glideraService.getToken(code, function(err, data) {
|
||||
self.loading = null;
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
}
|
||||
else if (data && data.access_token) {
|
||||
storageService.setGlideraToken(fc.credentials.network, data.access_token, function() {
|
||||
$scope.$emit('Local/GlideraTokenUpdated', data.access_token);
|
||||
$timeout(function() {
|
||||
self.loading = null;
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
glideraService.sell(token, twoFaCode, data, function(err, data) {
|
||||
self.loading = null;
|
||||
if (err) {
|
||||
self.error = gettext('Could not sell bitcoin');
|
||||
self.error = err;
|
||||
fc.removeTxProposal(txp, function(err, txpb) {
|
||||
$timeout(function() {
|
||||
$scope.$emit('Local/GlideraError');
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
|||
return cb(null, data.data);
|
||||
}, function(data) {
|
||||
$log.error('Glidera Authorization Access Token: ERROR ' + data.statusText);
|
||||
return cb(data.statusText);
|
||||
return cb('Glidera Authorization Access Token: ERROR ' + data.statusText);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
|||
return cb(null, data.data);
|
||||
}, function(data) {
|
||||
$log.error('Glidera Access Token Permissions: ERROR ' + data.statusText);
|
||||
return cb('Glidera Access Token Permissions: ERROR');
|
||||
return cb('Glidera Access Token Permissions: ERROR ' + data.statusText);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
|||
return cb(null, data.data);
|
||||
}, function(data) {
|
||||
$log.error('Glidera Get Email: ERROR ' + data.statusText);
|
||||
return cb(data.statusText);
|
||||
return cb('Glidera Get Email: ERROR ' + data.statusText);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
|||
return cb(null, data.data);
|
||||
}, function(data) {
|
||||
$log.error('Glidera Get Personal Info: ERROR ' + data.statusText);
|
||||
return cb(data.statusText);
|
||||
return cb('Glidera Get Personal Info: ERROR ' + data.statusText);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
|||
return cb(null, data.data);
|
||||
}, function(data) {
|
||||
$log.error('Glidera User Status: ERROR ' + data.statusText);
|
||||
return cb(data.statusText);
|
||||
return cb('Glidera User Status: ERROR ' + data.statusText);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
|||
return cb(null, data.data);
|
||||
}, function(data) {
|
||||
$log.error('Glidera Transaction Limits: ERROR ' + data.statusText);
|
||||
return cb(data.statusText);
|
||||
return cb('Glidera Transaction Limits: ERROR ' + data.statusText);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
|||
return cb(null, data.data.transactions);
|
||||
}, function(data) {
|
||||
$log.error('Glidera Transactions: ERROR ' + data.statusText);
|
||||
return cb(data.statusText);
|
||||
return cb('Glidera Transactions: ERROR ' + data.statusText);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
|||
return cb(null, data.data);
|
||||
}, function(data) {
|
||||
$log.error('Glidera Transaction: ERROR ' + data.statusText);
|
||||
return cb(data.statusText);
|
||||
return cb('Glidera Transaction: ERROR ' + data.statusText);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
|||
return cb(null, data.data.sellAddress);
|
||||
}, function(data) {
|
||||
$log.error('Glidera Create Sell Address: ERROR ' + data.statusText);
|
||||
return cb(data.statusText);
|
||||
return cb('Glidera Create Sell Address: ERROR ' + data.statusText);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -162,7 +162,7 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
|||
return cb(null, data.status == 200 ? true : false);
|
||||
}, function(data) {
|
||||
$log.error('Glidera Sent 2FA code by SMS: ERROR ' + data.statusText);
|
||||
return cb(data.statusText);
|
||||
return cb('Glidera Sent 2FA code by SMS: ERROR ' + data.statusText);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
|||
return cb(null, data.data);
|
||||
}, function(data) {
|
||||
$log.error('Glidera Sell Price: ERROR ' + data.statusText);
|
||||
return cb(data.statusText);
|
||||
return cb('Glidera Sell Price: ERROR ' + data.statusText);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -206,8 +206,8 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
|||
$log.info('Glidera Sell: SUCCESS');
|
||||
return cb(null, data.data);
|
||||
}, function(data) {
|
||||
$log.error('Glidera Sell: ERROR ' + data.statusText);
|
||||
return cb(data.statusText);
|
||||
$log.error('Glidera Sell Request: ERROR ' + data.statusText);
|
||||
return cb('Glidera Sell Request: ERROR ' + data.statusText);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -221,7 +221,7 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
|||
return cb(null, data.data);
|
||||
}, function(data) {
|
||||
$log.error('Glidera Buy Price: ERROR ' + data.statusText);
|
||||
return cb(data.statusText);
|
||||
return cb('Glidera Buy Price: ERROR ' + data.statusText);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -237,8 +237,8 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
|||
$log.info('Glidera Buy: SUCCESS');
|
||||
return cb(null, data.data);
|
||||
}, function(data) {
|
||||
$log.error('Glidera Buy: ERROR ' + data.statusText);
|
||||
return cb(data.statusText);
|
||||
$log.error('Glidera Buy Request: ERROR ' + data.statusText);
|
||||
return cb('Glidera Buy Request: ERROR ' + data.statusText);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue