diff --git a/awx/ui/client/src/shared/socket/socket.service.js b/awx/ui/client/src/shared/socket/socket.service.js index da3d471576..afae6fb36f 100644 --- a/awx/ui/client/src/shared/socket/socket.service.js +++ b/awx/ui/client/src/shared/socket/socket.service.js @@ -5,8 +5,8 @@ *************************************************/ import ReconnectingWebSocket from 'reconnectingwebsocket'; export default -['$rootScope', '$location', '$log','$state', '$q', 'i18n', - function ($rootScope, $location, $log, $state, $q, i18n) { +['$rootScope', '$location', '$log','$state', '$q', 'i18n', 'GetBasePath', 'Rest', + function ($rootScope, $location, $log, $state, $q, i18n, GetBasePath, Rest) { var needsResubscribing = false, socketPromise = $q.defer(), needsRefreshAfterBlur; @@ -130,16 +130,16 @@ export default else if(data.group_name==="inventory_update_events"){ str = `ws-${data.group_name}-${data.inventory_update}`; } - else if(data.group_name==="control" && data.reason=="limit_reached"){ + else if(data.group_name === "control" && data.reason === "limit_reached"){ // If we got a `limit_reached_` message, determine // if the current session is still valid (it may have been // invalidated) // If so, log the user out and show a meaningful error $log.debug(data.reason); - self.$.ajax({ - url: '/api/v2/me/' - }).error(function(resp, status) { - if (resp.status == 401) { + let url = GetBasePath('me'); + Rest.get(url) + .catch(function(resp) { + if (resp.status === 401) { $rootScope.sessionTimer.expireSession('session_limit'); $state.go('signOut'); } @@ -165,7 +165,7 @@ export default // listen for specific messages. A subscription object could // look like {"groups":{"jobs": ["status_changed", "summary"]}. // This is used by all socket-enabled $states - state.data.socket.groups['control'] = ['limit_reached_' + $rootScope.current_user.id]; + state.data.socket.groups.control = ['limit_reached_' + $rootScope.current_user.id]; this.emit(JSON.stringify(state.data.socket)); this.setLast(state); },