Skip to content

Instantly share code, notes, and snippets.

@aj-dev
Created October 5, 2017 19:44
Show Gist options
  • Save aj-dev/c697f739313dc31dea79253255ccd4f4 to your computer and use it in GitHub Desktop.
Save aj-dev/c697f739313dc31dea79253255ccd4f4 to your computer and use it in GitHub Desktop.
profileService
(function () {
'use strict';
angular.module('evbox.profile')
.factory('profileService', profileService);
profileService.$inject = ['$http', 'sessionService'];
function profileService($http, sessionService) {
return {
/**
* Returns user profile object
* @returns {Promise.<Object>}
*/
getProfile: function () {
return sessionService.authenticate()
.then(sessionService.getUserProfile);
},
/**
* Updates user profile
* @param {Object} profile
* @returns {Promise.<Object>}
*/
updateProfile: function (profile) {
return $http.patch('/api/users/me', profile);
}
};
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment