darkID-prototype/clientApp/GUI/views/main/main.js
clientApp/GUI/views/main/main.jsRaw
1'use strict';
2
3angular.module('app.main', ['ngRoute'])
4
5 .config(['$routeProvider', function($routeProvider) {
6 $routeProvider.when('/main', {
7 templateUrl: 'views/main/main.html',
8 controller: 'MainCtrl'
9 });
10 }])
11
12 .controller('MainCtrl', function($scope, $rootScope, $http) {
13
14 $rootScope.server = JSON.parse(localStorage.getItem("darkID_server"));
15
16 $scope.generatingID = false;
17 $scope.ids = [];
18 $http.get(clientapi + 'ids')
19 .then(function(data) {
20 console.log('data success');
21 console.log(data);
22 $scope.ids = data.data;
23
24 }, function(data) {
25 console.log('data error');
26 });
27
28 $scope.newID = function() {
29 $scope.generatingID = true;
30 $http.get(clientapi + 'newid')
31 .then(function(data) {
32 console.log('data success');
33 console.log(data);
34 $scope.ids = data.data;
35 $scope.generatingID = false;
36
37 }, function(data) {
38 console.log('data error');
39 });
40 };
41
42 $scope.blindAndSendToSign = function(pubK) {
43 $http.get(clientapi + 'blindandsendtosign/' + pubK)
44 .then(function(data) {
45 console.log('data success');
46 console.log(data);
47 $scope.ids = data.data;
48
49 }, function(data) {
50 console.log('data error');
51 });
52 };
53 $scope.verify = function(pubK) {
54 $http.get(clientapi + 'verify/' + pubK)
55 .then(function(data) {
56 console.log('data success');
57 console.log(data);
58 $scope.ids = data.data;
59
60 }, function(data) {
61 console.log('data error');
62 });
63 };
64 });