Skip to content
Snippets Groups Projects
Unverified Commit 1233d59d authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Add and use auth object property

parent ce5f6b6b
No related branches found
No related tags found
No related merge requests found
Pipeline #16371 passed
......@@ -117,6 +117,7 @@ export class AuthKeycloak extends AdapterLitElement {
.then((person) => {
that.person = person;
window.DBPPerson = person;
this.sendSetPropertyEvents();
this._setLoginStatus(this._loginStatus, true);
});
}, {}, that.lang);
......@@ -124,11 +125,19 @@ export class AuthKeycloak extends AdapterLitElement {
}
sendSetPropertyEvents() {
this.sendSetPropertyEvent('auth-subject', this.subject);
this.sendSetPropertyEvent('auth-token', this.token);
this.sendSetPropertyEvent('user-full-name', this.name);
this.sendSetPropertyEvent('person-id', this.personId);
this.sendSetPropertyEvent('person', this.person);
this.sendSetPropertyEvent('auth', {
'subject': this.subject,
'token': this.token,
'user-full-name': this.name,
'person-id': this.personId,
'person': this.person,
});
// this.sendSetPropertyEvent('auth-subject', this.subject);
// this.sendSetPropertyEvent('auth-token', this.token);
// this.sendSetPropertyEvent('user-full-name', this.name);
// this.sendSetPropertyEvent('person-id', this.personId);
// this.sendSetPropertyEvent('person', this.person);
}
_setLoginStatus(status, force) {
......
......@@ -27,6 +27,7 @@ export class PersonSelect extends ScopedElementsMixin(AdapterLitElement) {
constructor() {
super();
this.auth = {};
this.lang = 'de';
this.entryPointUrl = '';
this.jsonld = null;
......@@ -65,6 +66,7 @@ export class PersonSelect extends ScopedElementsMixin(AdapterLitElement) {
showReloadButton: { type: Boolean, attribute: 'show-reload-button' },
reloadButtonTitle: { type: String, attribute: 'reload-button-title' },
showBirthDate: { type: Boolean, attribute: 'show-birth-date' },
auth: { type: Object },
};
}
......@@ -221,7 +223,7 @@ export class PersonSelect extends ScopedElementsMixin(AdapterLitElement) {
fetch(apiUrl, {
headers: {
'Content-Type': 'application/ld+json',
'Authorization': 'Bearer ' + window.DBPAuthToken,
'Authorization': 'Bearer ' + this.auth.token || window.DBPAuthToken,
},
})
.then(result => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment