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

Remove doInitializationOnce()

No longer needed
parent 4e0367a3
No related branches found
No related tags found
No related merge requests found
...@@ -51,6 +51,9 @@ export class AuthKeycloak extends AdapterLitElement { ...@@ -51,6 +51,9 @@ export class AuthKeycloak extends AdapterLitElement {
case 'lang': case 'lang':
i18n.changeLanguage(this.lang); i18n.changeLanguage(this.lang);
break; break;
case 'entryPointUrl':
// for preloading the instance
JSONLD.getInstance(this.entryPointUrl, this.lang);
case 'requestedLoginStatus': case 'requestedLoginStatus':
console.log("requested-login-status changed", this.requestedLoginStatus); console.log("requested-login-status changed", this.requestedLoginStatus);
switch(this.requestedLoginStatus) { switch(this.requestedLoginStatus) {
...@@ -152,7 +155,6 @@ export class AuthKeycloak extends AdapterLitElement { ...@@ -152,7 +155,6 @@ export class AuthKeycloak extends AdapterLitElement {
} }
this.sendSetPropertyEvent('auth', auth); this.sendSetPropertyEvent('auth', auth);
JSONLD.doInitializationOnce(this.entryPointUrl);
} }
_setLoginStatus(status, force) { _setLoginStatus(status, force) {
......
...@@ -309,9 +309,6 @@ export class CheckInPlaceSelect extends ScopedElementsMixin(AdapterLitElement) { ...@@ -309,9 +309,6 @@ export class CheckInPlaceSelect extends ScopedElementsMixin(AdapterLitElement) {
// we don't need to preset the selector if the entry point url changes // we don't need to preset the selector if the entry point url changes
this.initJSONLD(true); this.initJSONLD(true);
break; break;
case "auth":
JSONLD.doInitializationOnce(this.entryPointUrl);
break;
} }
}); });
......
...@@ -19,7 +19,6 @@ export default class JSONLD { ...@@ -19,7 +19,6 @@ export default class JSONLD {
static async getInstance(apiUrl, lang = 'de') { static async getInstance(apiUrl, lang = 'de') {
let promise = JSONLD.promises[apiUrl]; let promise = JSONLD.promises[apiUrl];
if (promise === undefined) { if (promise === undefined) {
JSONLD.doInitializationOnce(apiUrl);
promise = new Promise((resolve, reject) => { promise = new Promise((resolve, reject) => {
JSONLD.initialize( JSONLD.initialize(
apiUrl, apiUrl,
...@@ -52,24 +51,17 @@ export default class JSONLD { ...@@ -52,24 +51,17 @@ export default class JSONLD {
// add success and failure functions // add success and failure functions
if (typeof successFnc == 'function') JSONLD.successFunctions[apiUrl].push(successFnc); if (typeof successFnc == 'function') JSONLD.successFunctions[apiUrl].push(successFnc);
if (typeof failureFnc == 'function') JSONLD.failureFunctions[apiUrl].push(failureFnc); if (typeof failureFnc == 'function') JSONLD.failureFunctions[apiUrl].push(failureFnc);
}
/**
* This should be run as soon as possible (can be run multiple times)
*
* @param apiUrl
*/
static doInitializationOnce(apiUrl) {
// console.log("doInitializationOnce", apiUrl);
// check if api call was already started
if (!apiUrl || JSONLD.initStarted[apiUrl] !== undefined) { if (!apiUrl || JSONLD.initStarted[apiUrl] !== undefined) {
return; return;
} }
JSONLD.initStarted[apiUrl] = true; JSONLD.initStarted[apiUrl] = true;
JSONLD._doInitialization(apiUrl); JSONLD._doInitialization(apiUrl);
// console.log("doInitializationOnce Done", apiUrl); }
static doInitializationOnce(apiUrl) {
// No longer needed, remove any calls
} }
static _doInitialization(apiUrl) { static _doInitialization(apiUrl) {
......
...@@ -199,7 +199,6 @@ export class OrganizationSelect extends AdapterLitElement { ...@@ -199,7 +199,6 @@ export class OrganizationSelect extends AdapterLitElement {
}, {}, this.lang); }, {}, this.lang);
break; break;
case "auth": case "auth":
JSONLD.doInitializationOnce(this.entryPointUrl);
this.initAuthPersonOnce().then(); this.initAuthPersonOnce().then();
break; break;
default: default:
......
...@@ -67,9 +67,6 @@ export class PersonProfile extends DBPLitElement { ...@@ -67,9 +67,6 @@ export class PersonProfile extends DBPLitElement {
}); });
} }
break; break;
case "auth":
JSONLD.doInitializationOnce(this.entryPointUrl);
break;
default: default:
} }
}); });
......
...@@ -291,7 +291,6 @@ export class PersonSelect extends ScopedElementsMixin(AdapterLitElement) { ...@@ -291,7 +291,6 @@ export class PersonSelect extends ScopedElementsMixin(AdapterLitElement) {
this.initJSONLD(true); this.initJSONLD(true);
break; break;
case "auth": case "auth":
JSONLD.doInitializationOnce(this.entryPointUrl);
this.active = this.authenticated(); this.active = this.authenticated();
break; break;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment