Torkel Ödegaard 11 years ago
parent
commit
c65b7d1591
1 changed files with 10 additions and 4 deletions
  1. 10 4
      src/app/routes/p_admin.js

+ 10 - 4
src/app/routes/p_admin.js

@@ -26,7 +26,7 @@ function (angular) {
 
 
   });
   });
 
 
-  module.controller('AccountCtrl', function($scope, $http) {
+  module.controller('AccountCtrl', function($scope, $http, alertSrv) {
 
 
     $scope.collaborator = {};
     $scope.collaborator = {};
 
 
@@ -35,10 +35,16 @@ function (angular) {
         return;
         return;
       }
       }
 
 
-      $http.post('/api/account/collaborators/add', $scope.collaborator).then(function(results) {
-
+      $http.post('/api/account/collaborators/add', $scope.collaborator).then(function() {
+        alertSrv.set('Collaborator added', '', 'success', 3000);
       }, function(err) {
       }, function(err) {
-
+        if (err.data && err.data.status) {
+          alertSrv.set('Could not add collaborator', err.data.status, 'warning', 10000);
+        }
+        else if (err.statusText) {
+          alertSrv.set('Could not add collaborator', err.data.status, 'warning', 10000);
+        }
+        console.log("value", err);
       });
       });
     };
     };