$scope.referentials = Referential.query();
// Récupération de l'utilisateur actuel
- $scope.currentUser = Auth.getCurrentUser();
+ $scope.currentUser = angular.copy(Auth.getCurrentUser());
+ $scope.isAdmin = Auth.isAdmin();
$scope.errors = {};
}
};
+ var updateMe = function (params, cb, errorCb) {
+ Auth.updateMe(params)
+ .then(function () {
+ if (typeof cb === 'function') {
+ cb();
+ }
+ })
+ .catch(function (e) {
+ if (typeof errorCb === 'function') {
+ errorCb(e);
+ }
+ });
+ };
+
$scope.confirm = function (e) {
- $modalInstance.close(e);
+ updateMe($scope.currentUser, function () {
+ angular.copy($scope.currentUser, Auth.getCurrentUser());
+ $modalInstance.close(e);
+ });
};
$scope.cancel = function (e) {