From a008fef06c3c4ef4a29a77d5985a39adb5ac27b7 Mon Sep 17 00:00:00 2001 From: Miodec Date: Sat, 19 Feb 2022 21:10:03 +0100 Subject: [PATCH] fixed page changing twice on sign out --- .../scripts/controllers/account-controller.js | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/frontend/src/scripts/controllers/account-controller.js b/frontend/src/scripts/controllers/account-controller.js index c2c95f352..9faab7586 100644 --- a/frontend/src/scripts/controllers/account-controller.js +++ b/frontend/src/scripts/controllers/account-controller.js @@ -266,16 +266,18 @@ const authListener = firebase.auth().onAuthStateChanged(async function (user) { } PageTransition.set(false); } - if (window.location.pathname == "/login" && user) { - PageController.change("account"); - } else if (window.location.pathname != "/account") { - PageController.change(); - setTimeout(() => { - Focus.set(false); - }, 125 / 2); - } else { - Account.update(); - // SignOutButton.show(); + if (user) { + if (window.location.pathname == "/login") { + PageController.change("account"); + } else if (window.location.pathname != "/account") { + PageController.change(); + setTimeout(() => { + Focus.set(false); + }, 125 / 2); + } else { + Account.update(); + // SignOutButton.show(); + } } let theme = Misc.findGetParameter("customTheme");