Matteo Scandolo | a5d03d5 | 2016-07-21 11:35:46 -0700 | [diff] [blame] | 1 | (function() {
|
| 2 | 'use strict';
|
| 3 |
|
| 4 | angular.module('xos.helpers')
|
| 5 | /**
|
| 6 | * @ngdoc service
|
| 7 | * @name xos.helpers.Me
|
| 8 | * @description Http read-only api to fetch /api/utility/me/
|
| 9 | **/
|
| 10 | .service('Me', function($q,$http){
|
| 11 |
|
| 12 | this.get = () => {
|
| 13 | let deferred = $q.defer();
|
| 14 |
|
| 15 | $http.get('/api/utility/me/')
|
| 16 | .then(res => {
|
| 17 | deferred.resolve(res.data);
|
| 18 | })
|
| 19 | .catch(e => {
|
| 20 | deferred.reject(e);
|
| 21 | });
|
| 22 | return deferred.promise;
|
| 23 |
|
| 24 | };
|
| 25 | })
|
| 26 | })(); |