From 7a98e5ed234e5a7a0dc2a8e04b1ebccf7ea2fb29 Mon Sep 17 00:00:00 2001 From: Robert Zorko Date: Wed, 14 Oct 2015 12:13:50 +0200 Subject: fixed the logout bug when the user logs out while in the problem screen - the transition to the login screen must be performed before the logout happens --- js/codeq/navigation.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'js/codeq/navigation.js') diff --git a/js/codeq/navigation.js b/js/codeq/navigation.js index 57b398d..dab907a 100644 --- a/js/codeq/navigation.js +++ b/js/codeq/navigation.js @@ -61,7 +61,7 @@ } }, 'destroy': function () { - if (currState !== null) currState.exit(); + if (currState) currState.exit(); currState = null; History.Adapter.unbind(window, 'statechange', stateChangeFun); }, @@ -108,11 +108,12 @@ e.preventDefault(); }); $('#navigation-logout').on('click', function(e){ + codeq.globalStateMachine.transition('login'); + codeq.comms.logout() .then(function (data) { console.log(data); codeq.comms.disconnect(); - codeq.globalStateMachine.transition('login'); }) .fail(function (reason) { console.log(reason); -- cgit v1.2.1