web: set favicon based on current tenants branding logo

closes #956

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-06-02 14:38:24 +02:00
parent 4f04ab7a5f
commit b339452843
1 changed files with 7 additions and 1 deletions

View File

@ -25,7 +25,13 @@ export function config(): Promise<Config> {
let globalTenantPromise: Promise<CurrentTenant>; let globalTenantPromise: Promise<CurrentTenant>;
export function tenant(): Promise<CurrentTenant> { export function tenant(): Promise<CurrentTenant> {
if (!globalTenantPromise) { if (!globalTenantPromise) {
globalTenantPromise = new CoreApi(DEFAULT_CONFIG).coreTenantsCurrentRetrieve(); globalTenantPromise = new CoreApi(DEFAULT_CONFIG).coreTenantsCurrentRetrieve().then(tenant => {
const relIcon = document.head.querySelector<HTMLLinkElement>("link[rel=icon]");
if (relIcon) {
relIcon.href = tenant.brandingLogo;
}
return tenant;
});
} }
return globalTenantPromise; return globalTenantPromise;
} }