Initial COmmit WIP
This commit is contained in:
31
js/service/apiservice.js
Normal file
31
js/service/apiservice.js
Normal file
@@ -0,0 +1,31 @@
|
||||
app.factory('ApiService', function($http){
|
||||
var ApiService = function(http, BASEURL,endpoint) {
|
||||
this.endpoint = endpoint;
|
||||
this.baseUrl = OC.generateUrl('/apps/deck/' + endpoint);
|
||||
this.http = http;
|
||||
this.hashMap = {};
|
||||
this.values = [];
|
||||
};
|
||||
|
||||
ApiService.prototype.getAll = function(){
|
||||
return $http.get(baseUrl);
|
||||
}
|
||||
|
||||
ApiService.prototype.getOne = function (id) {
|
||||
return $http.get(baseUrl + '/' + id);
|
||||
};
|
||||
|
||||
ApiService.prototype.create = function (entity) {
|
||||
return $http.post(baseUrl, entity);
|
||||
};
|
||||
|
||||
ApiService.prototype.update = function (entity) {
|
||||
return $http.put(baseUrl, entity)
|
||||
};
|
||||
|
||||
ApiService.prototype.delete = function (id) {
|
||||
return $http.delete(baseUrl + '/' + id);
|
||||
};
|
||||
|
||||
return ApiService;
|
||||
});
|
||||
Reference in New Issue
Block a user