fix(console): header image fallback (#3735)

fix: fallback icon in header

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Max Peintner 2022-05-31 09:14:52 +02:00 committed by GitHub
parent f9e9b4b64b
commit 47feced1cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -10,20 +10,20 @@
alt="home logo"
*ngIf="isDarkTheme; else customlighttheme"
[src]="labelpolicy?.iconUrlDark ? labelpolicy.iconUrlDark : './assets/images/zitadel-logo-solo-light.svg'"
onerror="this.src='./assets/images/zitadel-logo-solo-light.svg';this.onerror='';"
(error)="errorHandler($event, './assets/images/zitadel-logo-solo-light.svg')"
/>
<ng-template #customlighttheme>
<img
alt="home logo"
class="logo"
[src]="labelpolicy?.iconUrl ? labelpolicy.iconUrl : './assets/images/zitadel-logo-solo-dark.svg'"
onerror="this.src='./assets/images/zitadel-logo-solo-dark.svg';this.onerror='';"
(error)="errorHandler($event, './assets/images/zitadel-logo-solo-dark.svg')"
/>
</ng-template>
</a>
<ng-template #defaultHome>
<a *ngIf="org" class="title" [routerLink]="['/']">
<a class="title" [routerLink]="['/']">
<img
class="logo"
alt="zitadel logo"
@ -31,7 +31,7 @@
src="./assets/images/zitadel-logo-solo-light.svg"
/>
<ng-template #lighttheme>
<img alt="zitadel logo" class="logo" src="../assets/images/zitadel-logo-solo-dark.svg" />
<img alt="zitadel logo" class="logo" src="./assets/images/zitadel-logo-solo-dark.svg" />
</ng-template>
</a>
</ng-template>

View File

@ -67,6 +67,10 @@ export class HeaderComponent implements OnDestroy {
return this.router.url === '/users/me';
}
public errorHandler(event: any, fallbackSrc: string) {
(event.target as HTMLImageElement).src = fallbackSrc;
}
public get isOnInstance(): boolean {
const pages: string[] = [
'/instance',