1
0
mirror of https://github.com/Foltik/Shimapan synced 2024-11-15 09:08:06 -05:00
shimapan/app/public/services/KeySvc.js

38 lines
891 B
JavaScript
Raw Normal View History

2018-08-14 05:13:59 -04:00
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);
});
};
}]);