zettapi_client
Version:
Admin panel and client-side CRUD operations in angular to use with zettapi_server rest api to get started quickly in any CMS project.
27 lines (24 loc) • 999 B
JavaScript
app.service('$report', function($http, blockUI, $httpParamSerializer, zapi) {
this.getMetadata = function(reportKey, callback) {
var url = zapi.serverUrl + '/api/report/metadata/' + reportKey;
blockUI.start('A obter meta dados...');
$http.get(url).then(function(response) {
callback(null, response.data);
}).catch(function(response) {
callback(response.data);
}).finally(function() {
blockUI.stop();
});
};
this.getReport = function(namespace, db, reportKey, item, callback) {
var url = zapi.serverUrl + '/api/report/get/' + namespace + '/' + db + '/' + reportKey + '?' + $httpParamSerializer(item);
blockUI.start('A obter dados...');
$http.get(url).then(function(response) {
callback(null, response.data);
}).catch(function(response) {
callback(response.data);
}).finally(function() {
blockUI.stop();
});
};
});