Added possible fix for toLowerCase() errors in PROD

This commit is contained in:
Erik Tiekstra
2021-12-15 08:44:43 +01:00
parent a6f37923ab
commit fa82a023c0
3 changed files with 4 additions and 3 deletions

View File

@@ -27,7 +27,8 @@ export class ToastComponent implements AfterViewInit {
} }
get className(): string { get className(): string {
return `toast toast--${this.error.severity.toLowerCase()}`; const severity = this.error.severity || ErrorSeverity.HIGH;
return `toast toast--${severity.toLowerCase()}`;
} }
emitCloseEvent(): void { emitCloseEvent(): void {

View File

@@ -53,7 +53,7 @@
[afActive]="activeReportMotivation" [afActive]="activeReportMotivation"
(afOnPrimaryClick)="closeMotivationDialog()" (afOnPrimaryClick)="closeMotivationDialog()"
(afOnInactive)="closeMotivationDialog()" (afOnInactive)="closeMotivationDialog()"
[afHeading]="'Motivering till beslut: ' + activeReportMotivation.type + ' ' + activeReportMotivation.status.toLowerCase()" [afHeading]="'Motivering till beslut: ' + activeReportMotivation.type + ' ' + activeReportMotivation.status?.toLowerCase()"
afHeadingLevel="h2" afHeadingLevel="h2"
afPrimaryButtonText="Stäng" afPrimaryButtonText="Stäng"
> >

View File

@@ -1,4 +1,4 @@
export function capitalizeWords(words: string): string { export function capitalizeWords(words: string = ''): string {
return words return words
.split(' ') .split(' ')
.map(word => `${word.charAt(0).toUpperCase()}${word.slice(1).toLowerCase()}`) .map(word => `${word.charAt(0).toUpperCase()}${word.slice(1).toLowerCase()}`)