summaryrefslogtreecommitdiff
path: root/public/js/lib
diff options
context:
space:
mode:
Diffstat (limited to 'public/js/lib')
-rw-r--r--public/js/lib/common/login.js9
1 files changed, 3 insertions, 6 deletions
diff --git a/public/js/lib/common/login.js b/public/js/lib/common/login.js
index f1a03c72..58fa55c6 100644
--- a/public/js/lib/common/login.js
+++ b/public/js/lib/common/login.js
@@ -4,7 +4,7 @@ let checkAuth = false;
let profile = null;
let lastLoginState = getLoginState();
let lastUserId = getUserId();
-let loginStateChangeEvent = null;
+var loginStateChangeEvent = null;
export function setloginStateChangeEvent(func) {
loginStateChangeEvent = func;
@@ -32,9 +32,7 @@ export function setLoginState(bool, id) {
export function checkLoginStateChanged() {
if (getLoginState() != lastLoginState || getUserId() != lastUserId) {
- if (loginStateChangeEvent) {
- loginStateChangeEvent();
- }
+ if (loginStateChangeEvent) setTimeout(loginStateChangeEvent, 100);
return true;
} else {
return false;
@@ -56,8 +54,7 @@ export function clearLoginState() {
export function checkIfAuth(yesCallback, noCallback) {
const cookieLoginState = getLoginState();
- if (checkLoginStateChanged())
- checkAuth = false;
+ if (checkLoginStateChanged()) checkAuth = false;
if (!checkAuth || typeof cookieLoginState == 'undefined') {
$.get(`${serverurl}/me`)
.done(data => {