Wallet/src/js/controllers/preferencesBitpayCard.js

33 lines
1 KiB
JavaScript
Raw Normal View History

2016-08-10 15:29:31 -03:00
'use strict';
angular.module('copayApp.controllers').controller('preferencesBitpayCardController',
function($scope, $state, $timeout, $ionicHistory, bitpayCardService, popupService, gettextCatalog) {
2016-08-10 15:29:31 -03:00
2016-11-11 18:11:52 -05:00
$scope.remove = function(card) {
var msg = gettextCatalog.getString('Are you sure you would like to remove your BitPay Card account from this device?');
2016-10-05 11:42:40 -03:00
popupService.showConfirm(null, msg, null, null, function(res) {
2016-11-11 18:11:52 -05:00
if (res) remove(card);
});
};
2016-11-11 18:11:52 -05:00
var remove = function(card) {
bitpayCardService.remove(card, function(err) {
if (err) {
$scope.error = gettextCatalog.getString('Could not remove card');
return;
}
2016-11-14 15:17:05 -03:00
$ionicHistory.clearHistory();
$timeout(function() {
2016-09-28 21:09:41 -03:00
$state.go('tabs.home');
}, 100);
2016-08-10 15:29:31 -03:00
});
};
$scope.$on("$ionicView.beforeEnter", function(event, data) {
bitpayCardService.getBitpayDebitCards(function(err, data) {
if (err) return;
2016-11-11 18:11:52 -05:00
$scope.bitpayCards = data;
});
});
2016-08-10 15:29:31 -03:00
});