You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2019/06/25 15:53:24 UTC

[GitHub] [trafficcontrol] mitchell852 commented on a change in pull request #3601: Removed restangular from AuthService.js

mitchell852 commented on a change in pull request #3601: Removed restangular from AuthService.js
URL: https://github.com/apache/trafficcontrol/pull/3601#discussion_r297263561
 
 

 ##########
 File path: traffic_portal/app/src/common/api/AuthService.js
 ##########
 @@ -17,64 +17,60 @@
  * under the License.
  */
 
-var AuthService = function($rootScope, $http, $state, $location, $q, $state, httpService, userModel, messageModel, ENV) {
+var AuthService = function($rootScope, $http, $state, $location, userModel, messageModel, ENV) {
 
     this.login = function(username, password) {
         userModel.resetUser();
-        return httpService.post(ENV.api['root'] + 'user/login', { u: username, p: password })
-            .then(
-                function(result) {
-                    $rootScope.$broadcast('authService::login');
-                    var redirect = decodeURIComponent($location.search().redirect);
-                    if (redirect !== 'undefined') {
-                        $location.search('redirect', null); // remove the redirect query param
-                        $location.url(redirect);
-                    } else {
-                        $location.url('/');
-                    }
-                },
-                function(fault) {
-                    // do nothing
+        return $http.post(ENV.api['root'] + 'user/login', { u: username, p: password }).then(
+            function(result) {
+                $rootScope.$broadcast('authService::login');
+                const redirect = decodeURIComponent($location.search().redirect);
+                if (redirect !== 'undefined') {
+                    $location.search('redirect', null); // remove the redirect query param
+                    $location.url(redirect);
+                } else {
+                    $location.url('/');
                 }
-            );
+                return result;
+            },
+            function(err) {
+                throw err;
 
 Review comment:
   https://github.com/apache/trafficcontrol/blob/master/traffic_portal/app/src/modules/public/login/LoginController.js#L30
   
   because there's no handler for the failure state (when you enter a bad username/password for example), the Log in button never re-enables itself.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services