/**
* @ngdoc service
* @name DashboardService
* @module s4c.services.DashboardService
*
* @description Componente para acesso a api do backend e/ou comunicação entre controllers
*
*
*/
'use strict';
(function () {
/**
* @method DashboardService
* @param {*} $http
* @param {*} $q
* @param {*} API_ENDPOINT
*/
function DashboardService(API_ENDPOINT, $q, $http) {
/**
* @method getInformations
* @param {*} obj
*/
function getInformations(obj) {
var deferred = $q.defer();
$http.post(API_ENDPOINT + 'dashboard', obj)
.then(function (res) {
if (typeof res.data === 'object') {
deferred.resolve(res.data);
} else {
deferred.reject();
}
}, function (err) {
deferred.reject(err);
});
return deferred.promise;
}
return {
getInformations: getInformations
};
}
angular.module('s4c.services')
.factory('DashboardService', DashboardService);
DashboardService.$inject = ['API_ENDPOINT', '$q', '$http'];
}());