Wallet/src/js/controllers/preferencesGlidera.js

61 lines
1.7 KiB
JavaScript
Raw Normal View History

2015-08-28 18:23:24 -03:00
'use strict';
angular.module('copayApp.controllers').controller('preferencesGlideraController',
2015-09-07 11:14:09 -03:00
function($scope, $modal, $timeout, profileService, applicationService, glideraService, storageService) {
2015-08-28 18:23:24 -03:00
2015-09-07 11:14:09 -03:00
this.getEmail = function(token) {
2015-08-28 18:23:24 -03:00
var self = this;
2015-09-07 11:14:09 -03:00
glideraService.getEmail(token, function(error, data) {
self.email = data;
2015-08-28 18:23:24 -03:00
});
2015-09-07 11:14:09 -03:00
};
2015-08-28 18:23:24 -03:00
2015-09-07 11:14:09 -03:00
this.getPersonalInfo = function(token) {
var self = this;
2015-08-28 18:23:24 -03:00
glideraService.getPersonalInfo(token, function(error, info) {
self.personalInfo = info;
});
2015-09-07 11:14:09 -03:00
};
2015-08-28 18:23:24 -03:00
2015-09-07 11:14:09 -03:00
this.getStatus = function(token) {
var self = this;
glideraService.getStatus(token, function(error, data) {
self.status = data;
2015-08-28 18:23:24 -03:00
});
2015-09-07 11:14:09 -03:00
};
2015-08-28 18:23:24 -03:00
2015-09-07 11:14:09 -03:00
this.getLimits = function(token) {
var self = this;
2015-08-28 18:23:24 -03:00
glideraService.getLimits(token, function(error, limits) {
self.limits = limits;
});
2015-09-07 11:14:09 -03:00
};
2015-08-28 18:23:24 -03:00
this.revokeToken = function() {
var fc = profileService.focusedClient;
2015-09-07 11:14:09 -03:00
var ModalInstanceCtrl = function($scope, $modalInstance) {
$scope.ok = function() {
$modalInstance.close(true);
};
$scope.cancel = function() {
$modalInstance.dismiss();
};
};
var modalInstance = $modal.open({
templateUrl: 'views/modals/glidera-confirmation.html',
windowClass: 'full',
controller: ModalInstanceCtrl
});
modalInstance.result.then(function(ok) {
if (ok) {
storageService.removeGlideraToken(fc.credentials.network, function() {
$timeout(function() {
applicationService.restart();
}, 100);
});
}
2015-08-28 18:23:24 -03:00
});
};
});