mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-22 16:29:09 +01:00
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",
|
||||
component: RemovePasswordComponent,
|
||||
|
@ -27,9 +27,21 @@ export class AnonLayoutWrapperComponent {
|
||||
private route: ActivatedRoute,
|
||||
private i18nService: I18nService,
|
||||
) {
|
||||
this.pageTitle = this.i18nService.t(this.route.snapshot.firstChild.data["pageTitle"]);
|
||||
this.pageSubtitle = this.i18nService.t(this.route.snapshot.firstChild.data["pageSubtitle"]);
|
||||
this.pageIcon = this.route.snapshot.firstChild.data["pageIcon"];
|
||||
this.showReadonlyHostname = this.route.snapshot.firstChild.data["showReadonlyHostname"];
|
||||
const routeData = this.route.snapshot.firstChild?.data;
|
||||
|
||||
if (!routeData) {
|
||||
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
Block a user