|
|
@@ -1,37 +1,40 @@ |
|
|
|
var angular = require('angular'); |
|
|
|
|
|
|
|
angular.module('KeySvc', []).service('KeyService', ['$http', function ($http) { |
|
|
|
this.getAllKeys = function (cb) { |
|
|
|
angular.module('KeySvc', []).service('KeyService', ['$http', function($http) { |
|
|
|
this.createKey = (identifier, scope, cb) => |
|
|
|
$http({ |
|
|
|
method: 'GET', |
|
|
|
url: '/api/keys/get' |
|
|
|
}).then(function (res) { |
|
|
|
cb(res.data); |
|
|
|
method: 'POST', |
|
|
|
url: '/api/keys/create', |
|
|
|
data: { |
|
|
|
identifier: identifier, |
|
|
|
scope: scope |
|
|
|
} |
|
|
|
}).then(res => { |
|
|
|
cb(null, res.data) |
|
|
|
}).catch(err => { |
|
|
|
cb(err); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
this.deleteKey = function (key, cb) { |
|
|
|
this.deleteKey = (key, cb) => |
|
|
|
$http({ |
|
|
|
method: 'POST', |
|
|
|
url: '/api/keys/delete', |
|
|
|
data: { |
|
|
|
key: key |
|
|
|
} |
|
|
|
}).then(function (res) { |
|
|
|
cb(res.data); |
|
|
|
}).then(res => { |
|
|
|
cb(null, res.data); |
|
|
|
}).catch(err => { |
|
|
|
cb(err); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
this.createKey = function (identifier, scope, cb) { |
|
|
|
this.getAllKeys = cb => |
|
|
|
$http({ |
|
|
|
method: 'POST', |
|
|
|
url: '/api/keys/create', |
|
|
|
data: { |
|
|
|
identifier: identifier, |
|
|
|
scope: scope |
|
|
|
} |
|
|
|
}).then(function(res) { |
|
|
|
cb(res.data); |
|
|
|
method: 'GET', |
|
|
|
url: '/api/keys/get' |
|
|
|
}).then(res => { |
|
|
|
cb(null, res.data); |
|
|
|
}).catch(err => { |
|
|
|
cb(err); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}]); |