Skip to content
Snippets Groups Projects
Commit b036b7f7 authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire: Committed by Reiter, Christoph
Browse files

Add more api implementation

parent 79c0a10c
No related branches found
No related tags found
No related merge requests found
const vars = require("./vars");
module.exports = {
getAPiUrl: function(path = "", withPrefix = true) {
return vars.apiBaseUrl + (withPrefix ? vars.apiUrlPrefix : "") + path;
},
/**
* Reads a setting
*
......
auth @ c76f617c
Subproject commit 693af26211eecbe79f8c0ce5c22a4e48915af032
Subproject commit c76f617c689da8b379445e2980e230f3ad3a19c9
common @ 8786f24e
Subproject commit 45e52fbec09bf05c7e287703fc78b3040af69ac7
Subproject commit 8786f24eb39e717995747fa291c9fb1c770d4506
......@@ -36,7 +36,7 @@ class KnowledgeBaseWebPageElementViewDemo extends LitElement {
<vpu-auth lang="${this.lang}" client-id="${utils.setting('keyCloakClientId')}" load-person force-login></vpu-auth>
</div>
<div class="container">
<vpu-knowledge-base-web-page-element-view lang="${this.lang}"></vpu-knowledge-base-web-page-element-view>
<vpu-knowledge-base-web-page-element-view lang="${this.lang}" value="bedienstete/bibliothek/buch-ausleihen"></vpu-knowledge-base-web-page-element-view>
</div>
</section>
`;
......
......@@ -2,6 +2,7 @@ import {i18n} from './i18n';
import {html} from 'lit-element';
import JSONLD from 'vpu-common/jsonld';
import VPULitElement from 'vpu-common/vpu-lit-element'
import utils from "./utils";
/**
* KnowledgeBaseWebPageElementView web component
......@@ -10,6 +11,7 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement {
constructor() {
super();
this.lang = 'de';
this.value = '';
}
/**
......@@ -18,6 +20,7 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement {
static get properties() {
return {
lang: { type: String },
value: { type: String },
};
}
......@@ -26,6 +29,22 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement {
i18n.changeLanguage(this.lang);
const that = this;
JSONLD.initialize(utils.getAPiUrl(), function (jsonld) {
// TODO: there is no entity url without "collectionOperations"
const apiUrl = jsonld.getApiUrlForEntityName("KnowledgeBaseWebPageElement") + '/' + that.value;
console.log(apiUrl);
fetch(apiUrl, {
headers: {
'Content-Type': 'application/ld+json',
'Authorization': 'Bearer ' + that.token,
},
})
.then(response => response.json())
.then((person) => {
console.log(person);
});
});
this.updateComplete.then(()=>{
});
......
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