Skip to content
Snippets Groups Projects
Commit 1997616c authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Set the global variables before we emit the status updates and emit after the person is loaded.

So we can use the update event to wait for the global variables in other components.

Also don't log the status when we get a request as with mulitple users we spam the logs.
Moved to the app receiving the events instead.
parent 6d9a66fd
No related branches found
No related tags found
No related merge requests found
...@@ -51,7 +51,6 @@ class VPUAuth extends VPULitElement { ...@@ -51,7 +51,6 @@ class VPUAuth extends VPULitElement {
status: this._loginStatus, status: this._loginStatus,
token: this.token, token: this.token,
}; };
console.log('Login status: ' + this._loginStatus);
return message; return message;
}; };
...@@ -84,6 +83,13 @@ class VPUAuth extends VPULitElement { ...@@ -84,6 +83,13 @@ class VPUAuth extends VPULitElement {
newPerson = true; newPerson = true;
} }
this.personId = personId; this.personId = personId;
window.VPUAuthSubject = this.subject;
window.VPUAuthToken = this.token;
window.VPUUserFullName = this.name;
window.VPUPersonId = this.personId;
window.VPUPerson = this.person;
this._setLoginStatus(LoginStatus.LOGGED_IN, tokenChanged); this._setLoginStatus(LoginStatus.LOGGED_IN, tokenChanged);
} else { } else {
if (this._loginStatus === LoginStatus.LOGGED_IN) { if (this._loginStatus === LoginStatus.LOGGED_IN) {
...@@ -94,15 +100,16 @@ class VPUAuth extends VPULitElement { ...@@ -94,15 +100,16 @@ class VPUAuth extends VPULitElement {
this.subject = ""; this.subject = "";
this.personId = ""; this.personId = "";
this.person = null; this.person = null;
window.VPUAuthSubject = this.subject;
window.VPUAuthToken = this.token;
window.VPUUserFullName = this.name;
window.VPUPersonId = this.personId;
window.VPUPerson = this.person;
this._setLoginStatus(LoginStatus.LOGGED_OUT); this._setLoginStatus(LoginStatus.LOGGED_OUT);
} }
window.VPUAuthSubject = this.subject;
window.VPUAuthToken = this.token;
window.VPUUserFullName = this.name;
window.VPUPersonId = this.personId;
window.VPUPerson = this.person;
const that = this; const that = this;
if (newPerson) { if (newPerson) {
...@@ -127,6 +134,7 @@ class VPUAuth extends VPULitElement { ...@@ -127,6 +134,7 @@ class VPUAuth extends VPULitElement {
that.person = person; that.person = person;
window.VPUPerson = person; window.VPUPerson = person;
that.dispatchEvent(that.personInitEvent); that.dispatchEvent(that.personInitEvent);
this._setLoginStatus(this._loginStatus, true);
}); });
}, {}, that.lang); }, {}, that.lang);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment