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

Integrate auth property into dbp-person-profile

parent 04c7e747
No related branches found
No related tags found
No related merge requests found
Pipeline #16454 passed
......@@ -21,6 +21,8 @@ npm i @dbp-toolkit/person-profile
- example `<dbp-person-profile entry-point-url="http://127.0.0.1:8000"></dbp-person-profile>`
- `value` (optional): api path of person to preload the selector with
- example `<dbp-person-profile value="/people/testuser"></dbp-person-profile>`
- `auth` object: you need to set that object property for the auth token
- example auth property: `{token: "THE_BEARER_TOKEN"}`
## Local development
......
......@@ -7,6 +7,6 @@
<body>
<dbp-person-profile-demo lang="de" entry-point-url="http://127.0.0.1:8000"></dbp-person-profile-demo>
<dbp-person-profile-demo auth lang="de" entry-point-url="http://127.0.0.1:8000"></dbp-person-profile-demo>
</body>
</html>
......@@ -97,7 +97,7 @@ export class PersonProfileDemo extends ScopedElementsMixin(DBPLitElement) {
<h1 class="title">Person-Profile-Demo</h1>
</div>
<div class="container">
<dbp-person-profile lang="${this.lang}" entry-point-url="${this.entryPointUrl}" value="${this.person}"></dbp-person-profile>
<dbp-person-profile subscribe="auth:auth" lang="${this.lang}" entry-point-url="${this.entryPointUrl}" value="${this.person}"></dbp-person-profile>
</div>
</section>
<section class="section">
......@@ -105,10 +105,10 @@ export class PersonProfileDemo extends ScopedElementsMixin(DBPLitElement) {
<h1 class="title">Select-Profile-Demo</h1>
</div>
<div class="container">
<dbp-person-select lang="${this.lang}" entry-point-url="${this.entryPointUrl}"></dbp-person-select>
<dbp-person-select subscribe="auth:auth" lang="${this.lang}" entry-point-url="${this.entryPointUrl}"></dbp-person-select>
</div>
<div class="container">
<dbp-person-profile lang="${this.lang}" entry-point-url="${this.entryPointUrl}" value="${this.selectedPerson}"></dbp-person-profile>
<dbp-person-profile subscribe="auth:auth" lang="${this.lang}" entry-point-url="${this.entryPointUrl}" value="${this.selectedPerson}"></dbp-person-profile>
</div>
</section>
`;
......
......@@ -15,6 +15,7 @@ export class PersonProfile extends DBPLitElement {
this.jsonld = null;
this.value = '';
this.person = null;
this.auth = {};
}
static get properties() {
......@@ -24,6 +25,7 @@ export class PersonProfile extends DBPLitElement {
entryPointUrl: { type: String, attribute: 'entry-point-url' },
value: { type: String },
person: { type: Object, attribute: false },
auth: { type: Object },
};
}
......@@ -56,7 +58,7 @@ export class PersonProfile extends DBPLitElement {
fetch(apiUrl, {
headers: {
'Content-Type': 'application/ld+json',
'Authorization': 'Bearer ' + window.DBPAuthToken,
'Authorization': 'Bearer ' + this.auth.token,
},
})
.then(response => response.json())
......
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