mirror of https://github.com/BTCPrivate/copay.git
add logout callback on beforeunload
This commit is contained in:
parent
48fd0f6fbb
commit
f4f060a45b
|
@ -44,11 +44,7 @@ angular.module('copay.header').controller('HeaderController',
|
|||
};
|
||||
|
||||
$scope.signout = function() {
|
||||
var w = $rootScope.wallet;
|
||||
if (w) {
|
||||
w.disconnect();
|
||||
controllerUtils.logout();
|
||||
}
|
||||
logout();
|
||||
$scope.clearFlashMessage();
|
||||
};
|
||||
|
||||
|
@ -64,4 +60,19 @@ angular.module('copay.header').controller('HeaderController',
|
|||
};
|
||||
|
||||
$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…
Reference in New Issue