Created
June 18, 2017 02:51
-
-
Save DevEarley/43e6f7b5c6c2c15de0a721d214321d6b to your computer and use it in GitHub Desktop.
Your Everyday service.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
angular.module('myApp').service('UserService', ['$http', '$window', function ($http, $window) { | |
return { | |
getUsers: function () { | |
return $http({ | |
method: 'GET', | |
url: $http.defaults.apiUrl + '/users', | |
headers: { 'Authorization': $window.sessionStorage.token } | |
}).then(function (data) { return data.data; }); | |
}, | |
getUser: function (_userName) { | |
return $http({ | |
method: 'GET', | |
url: $http.defaults.apiUrl + '/userByName/' + _userName, | |
headers: { 'Authorization': $window.sessionStorage.token } | |
}).then(function (data) { return data.data; }); | |
} | |
} | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment