Remove token automatically from storage if it was revoked
This commit is contained in:
parent
5bbad38a99
commit
092b670861
2 changed files with 18 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('coinbaseController', function($scope, $timeout, $ionicModal, $log, coinbaseService, lodash, platformInfo, ongoingProcess, popupService, externalLinkService) {
|
||||
angular.module('copayApp.controllers').controller('coinbaseController', function($scope, $timeout, $ionicModal, $ionicHistory, $log, coinbaseService, lodash, platformInfo, ongoingProcess, popupService, externalLinkService) {
|
||||
|
||||
var isNW = platformInfo.isNW;
|
||||
var isCordova = platformInfo.isCordova;
|
||||
|
|
@ -17,8 +17,14 @@ angular.module('copayApp.controllers').controller('coinbaseController', function
|
|||
if (err || lodash.isEmpty(data)) {
|
||||
if (err) {
|
||||
$log.error(err);
|
||||
var errorId = err.errors ? err.errors[0].id : null;
|
||||
err = err.errors ? err.errors[0].message : err;
|
||||
popupService.showAlert('Error connecting to Coinbase', err);
|
||||
popupService.showAlert('Error connecting to Coinbase', err, function() {
|
||||
if (errorId == 'revoked_token') {
|
||||
coinbaseService.logout(function() {});
|
||||
}
|
||||
$ionicHistory.goBack();
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesCoinbaseController', function($scope, $timeout, $state, $ionicHistory, lodash, ongoingProcess, popupService, coinbaseService) {
|
||||
angular.module('copayApp.controllers').controller('preferencesCoinbaseController', function($scope, $timeout, $log, $state, $ionicHistory, lodash, ongoingProcess, popupService, coinbaseService) {
|
||||
|
||||
$scope.revokeToken = function() {
|
||||
popupService.showConfirm('Coinbase', 'Are you sure you would like to log out of your Coinbase account?', null, null, function(res) {
|
||||
|
|
@ -22,7 +22,15 @@ angular.module('copayApp.controllers').controller('preferencesCoinbaseController
|
|||
if (err || lodash.isEmpty(data)) {
|
||||
ongoingProcess.set('connectingCoinbase', false);
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
$log.error(err);
|
||||
var errorId = err.errors ? err.errors[0].id : null;
|
||||
err = err.errors ? err.errors[0].message : err;
|
||||
popupService.showAlert('Error connecting to Coinbase', err, function() {
|
||||
if (errorId == 'revoked_token') {
|
||||
coinbaseService.logout(function() {});
|
||||
$ionicHistory.goBack();
|
||||
}
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue