Matteo Scandolo | bf7c366 | 2016-06-02 20:30:15 -0700 | [diff] [blame] | 1 | (function () { |
| 2 | angular.module('mCord') |
Matteo Scandolo | 2c2c8af | 2016-06-03 15:36:02 -0700 | [diff] [blame] | 3 | .service('Enodeb', function($resource, $q, $http, baseUrl){ |
| 4 | const r = $resource(`${baseUrl}api/enodeb/:id`, {id: '@id'}); |
| 5 | |
| 6 | r.prototype.getProfiles = function(){ |
| 7 | const d = $q.defer(); |
| 8 | |
| 9 | $http.get(`${baseUrl}api/enodeb/${this.eNBId}/profile`) |
| 10 | .then(res => { |
| 11 | d.resolve(res.data); |
| 12 | }) |
| 13 | .catch(err => { |
| 14 | d.reject(err) |
| 15 | }); |
| 16 | |
| 17 | return d.promise; |
| 18 | }; |
| 19 | |
| 20 | r.prototype.getStats = function(){ |
| 21 | const d = $q.defer(); |
| 22 | |
| 23 | $http.get(`${baseUrl}api/stats/enodeb/${this.eNBId}/10`) |
| 24 | .then(res => { |
| 25 | d.resolve(res.data); |
| 26 | }) |
| 27 | .catch(err => { |
| 28 | d.reject(err) |
| 29 | }); |
| 30 | |
| 31 | return d.promise; |
| 32 | }; |
| 33 | |
| 34 | return r; |
Matteo Scandolo | bf7c366 | 2016-06-02 20:30:15 -0700 | [diff] [blame] | 35 | }) |
| 36 | })(); |