1
0
mirror of https://github.com/Foltik/Shimapan synced 2024-09-21 19:28:40 -04:00
shimapan/app/public/panel/controllers/ApiCtrl.js

35 lines
1.0 KiB
JavaScript
Raw Normal View History

var angular = require('angular');
2017-10-18 13:31:08 -04:00
angular.module('ApiCtrl', ['ApiSvc', 'AuthSvc']).controller('ApiController', ['$scope', 'ApiService', 'AuthService', function($scope, ApiService, AuthService) {
$scope.getKeys = function() {
ApiService.getAll(function(keys) {
$scope.keys = keys;
});
console.log($scope.keys);
};
2017-10-21 15:10:24 -04:00
$scope.hideNewKey = function() {
$scope.nModalShow = false;
};
$scope.showNewKey = function() {
$scope.nModalShow = true;
};
$scope.hideKeyInfo = function() {
$scope.kModalShow = false;
};
$scope.showKeyInfo = function(key) {
$scope.kModalShow = true;
$scope.currKey = key;
};
$scope.deleteKey = function(key) {
ApiService.deleteKey(key, function() {
var index = $scope.keys.indexOf(key);
console.log('removing index' + index);
$scope.keys.splice(index, 1);
$scope.hideKeyInfo();
$scope.currKey = {};
});
};
2017-10-18 13:31:08 -04:00
}]);