add logout callback on beforeunload
This commit is contained in:
parent
48fd0f6fbb
commit
f4f060a45b
1 changed files with 16 additions and 5 deletions
|
|
@ -44,11 +44,7 @@ angular.module('copay.header').controller('HeaderController',
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.signout = function() {
|
$scope.signout = function() {
|
||||||
var w = $rootScope.wallet;
|
logout();
|
||||||
if (w) {
|
|
||||||
w.disconnect();
|
|
||||||
controllerUtils.logout();
|
|
||||||
}
|
|
||||||
$scope.clearFlashMessage();
|
$scope.clearFlashMessage();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -64,4 +60,19 @@ angular.module('copay.header').controller('HeaderController',
|
||||||
};
|
};
|
||||||
|
|
||||||
$rootScope.isCollapsed = true;
|
$rootScope.isCollapsed = true;
|
||||||
|
|
||||||
|
function logout() {
|
||||||
|
var w = $rootScope.wallet;
|
||||||
|
if (w) {
|
||||||
|
w.disconnect();
|
||||||
|
controllerUtils.logout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensures a graceful disconnect
|
||||||
|
window.onbeforeunload = logout;
|
||||||
|
|
||||||
|
$scope.$on('$destroy', function() {
|
||||||
|
window.onbeforeunload = undefined;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue