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 18:35:24 UTC

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

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

 ##########
 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:
   Yeah, that's what I did. Plus, down with jQuery (and also fixed some targeting and event bubbling)

----------------------------------------------------------------
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