mirror of
https://github.com/ansible/awx.git
synced 2026-01-19 21:51:26 -03:30
Fix socket reconnect logic when browser is refreshed after token has expired
This commit is contained in:
parent
e653e9561a
commit
6034e6108a
@ -652,7 +652,9 @@ var tower = angular.module('Tower', [
|
||||
if($rootScope.dashboardInterval){
|
||||
window.clearInterval($rootScope.dashboardInterval);
|
||||
}
|
||||
sock.socket.socket.disconnect();
|
||||
if (sock) {
|
||||
sock.socket.socket.disconnect();
|
||||
}
|
||||
$location.path('/login');
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -100,8 +100,15 @@ angular.module('SocketIO', ['AuthService', 'Utilities'])
|
||||
});
|
||||
});
|
||||
self.socket.on('connect_failed', function(reason) {
|
||||
var r = reason || 'connection refused by host';
|
||||
$log.error('Socket connection failed: ' + r);
|
||||
var r = reason || 'connection refused by host',
|
||||
token_actual = Authorization.getToken();
|
||||
|
||||
$log.debug('Socket connection failed: ' + r);
|
||||
|
||||
if (token_actual === token) {
|
||||
self.socket.socket.disconnect();
|
||||
}
|
||||
|
||||
self.scope.$apply(function () {
|
||||
self.scope.socketStatus = 'error';
|
||||
self.scope.socketTip = getSocketTip(self.scope.socketStatus);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user