mirror of
https://github.com/Foltik/Shimapan
synced 2024-11-16 01:28:07 -05:00
38 lines
891 B
JavaScript
38 lines
891 B
JavaScript
var angular = require('angular');
|
|
|
|
angular.module('KeySvc', []).service('KeyService', ['$http', function ($http) {
|
|
this.getAllKeys = function (cb) {
|
|
$http({
|
|
method: 'GET',
|
|
url: '/api/keys/get'
|
|
}).then(function (res) {
|
|
cb(res.data);
|
|
});
|
|
};
|
|
|
|
this.deleteKey = function (key, cb) {
|
|
$http({
|
|
method: 'POST',
|
|
url: '/api/keys/delete',
|
|
data: {
|
|
key: key
|
|
}
|
|
}).then(function (res) {
|
|
cb(res.data);
|
|
});
|
|
};
|
|
|
|
this.createKey = function (identifier, scope, cb) {
|
|
$http({
|
|
method: 'POST',
|
|
url: '/api/keys/create',
|
|
data: {
|
|
identifier: identifier,
|
|
scope: scope
|
|
}
|
|
}).then(function(res) {
|
|
cb(res.data);
|
|
});
|
|
};
|
|
}]);
|