diff --git a/packages/auth/src/vpu-auth.js b/packages/auth/src/vpu-auth.js index 83c8ce25d963c6234170f92122223185158983ca..38547b0db2e0aa947dcbf0a10ce35e72d0903a1c 100644 --- a/packages/auth/src/vpu-auth.js +++ b/packages/auth/src/vpu-auth.js @@ -51,7 +51,6 @@ class VPUAuth extends VPULitElement { status: this._loginStatus, token: this.token, }; - console.log('Login status: ' + this._loginStatus); return message; }; @@ -84,6 +83,13 @@ class VPUAuth extends VPULitElement { newPerson = true; } 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); } else { if (this._loginStatus === LoginStatus.LOGGED_IN) { @@ -94,15 +100,16 @@ class VPUAuth extends VPULitElement { this.subject = ""; this.personId = ""; 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); } - window.VPUAuthSubject = this.subject; - window.VPUAuthToken = this.token; - window.VPUUserFullName = this.name; - window.VPUPersonId = this.personId; - window.VPUPerson = this.person; - const that = this; if (newPerson) { @@ -127,6 +134,7 @@ class VPUAuth extends VPULitElement { that.person = person; window.VPUPerson = person; that.dispatchEvent(that.personInitEvent); + this._setLoginStatus(this._loginStatus, true); }); }, {}, that.lang); }