Add collection of user metadata: name and company

This commit is contained in:
Joseph Schorr 2016-11-04 17:57:55 -04:00
parent 909be766c9
commit 0f2eb61f4a
14 changed files with 178 additions and 33 deletions

View file

@ -10,6 +10,7 @@
function UpdateUserCtrl($scope, UserService, $location, ApiService) {
$scope.state = 'loading';
$scope.metadata = {};
UserService.updateUserIn($scope, function(user) {
if (!user.prompts || !user.prompts.length) {
@ -43,15 +44,17 @@
});
};
$scope.updateUsername = function(username) {
$scope.state = 'updating';
var data = {
'username': username
};
ApiService.changeUserDetails(data).then(function() {
window.location = '/';
}, ApiService.errorDisplay('Could not update username'));
$scope.updateUser = function(data) {
$scope.state = 'updating';
ApiService.changeUserDetails(data).then(function() {
UserService.load(function(updated) {
if (updated.prompts.length) {
$scope.state = 'editing';
} else {
$location.url('/');
}
});
}, ApiService.errorDisplay('Could not update user information'));
};
$scope.hasPrompt = function(user, prompt_name) {