mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-28 22:15:12 -04:00
Merge branch 'master' into frontend-next
This commit is contained in:
commit
4bbe035beb
8 changed files with 95 additions and 59 deletions
|
@ -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 => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue