Check undefined data properties before i18n (#9590)
* remove duplicate route * check for undefined before translation
This commit is contained in:
parent
19d863c9ef
commit
9b0250d4fd
|
@ -238,25 +238,6 @@ const routes: Routes = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: "recover-2fa",
|
|
||||||
canActivate: [unauthGuardFn()],
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: "",
|
|
||||||
component: RecoverTwoFactorComponent,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "",
|
|
||||||
component: EnvironmentSelectorComponent,
|
|
||||||
outlet: "environment-selector",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
data: {
|
|
||||||
pageTitle: "recoverAccountTwoStep",
|
|
||||||
titleId: "recoverAccountTwoStep",
|
|
||||||
} satisfies DataProperties & AnonLayoutWrapperData,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "remove-password",
|
path: "remove-password",
|
||||||
component: RemovePasswordComponent,
|
component: RemovePasswordComponent,
|
||||||
|
|
|
@ -27,9 +27,21 @@ export class AnonLayoutWrapperComponent {
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
) {
|
) {
|
||||||
this.pageTitle = this.i18nService.t(this.route.snapshot.firstChild.data["pageTitle"]);
|
const routeData = this.route.snapshot.firstChild?.data;
|
||||||
this.pageSubtitle = this.i18nService.t(this.route.snapshot.firstChild.data["pageSubtitle"]);
|
|
||||||
this.pageIcon = this.route.snapshot.firstChild.data["pageIcon"];
|
if (!routeData) {
|
||||||
this.showReadonlyHostname = this.route.snapshot.firstChild.data["showReadonlyHostname"];
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (routeData["pageTitle"] !== undefined) {
|
||||||
|
this.pageTitle = this.i18nService.t(routeData["pageTitle"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (routeData["pageSubtitle"] !== undefined) {
|
||||||
|
this.pageSubtitle = this.i18nService.t(routeData["pageSubtitle"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.pageIcon = routeData["pageIcon"];
|
||||||
|
this.showReadonlyHostname = routeData["showReadonlyHostname"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue