From 5d95418ca32de5060a7521fef7b57b95cc262352 Mon Sep 17 00:00:00 2001 From: kirankumarb07 Date: Thu, 9 Mar 2023 18:17:58 +0530 Subject: Fix pre commit script break There is no validation handle before checking the page title name from the router. Which causes the pre-commit script to through error. This patch set will handle this scenario and fix the break. Change-Id: I5aed3bfeba643c2eb2b2753bf8f6d984b5100361 Signed-off-by: Kirankumar Ballapalli --- src/components/Global/PageTitle.vue | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/components') diff --git a/src/components/Global/PageTitle.vue b/src/components/Global/PageTitle.vue index e195d1ac..f5e6df92 100644 --- a/src/components/Global/PageTitle.vue +++ b/src/components/Global/PageTitle.vue @@ -21,18 +21,20 @@ export default { }; }, created() { - var title = this.$route.name; - var i = 1; - while (i < this.$route.name.split('-').length) { - var index = title.search('-'); - title = title.replace( - '-' + title.charAt(index + 1), - title.charAt(index + 1).toUpperCase() - ); - i++; + let title = this.$route.name; + let i = 1; + if (title) { + while (i < this.$route.name.split('-').length) { + let index = title.search('-'); + title = title.replace( + '-' + title.charAt(index + 1), + title.charAt(index + 1).toUpperCase() + ); + i++; + } + this.title = i18n.t('appPageTitle.' + title); + document.title = this.title; } - this.title = i18n.t('appPageTitle.' + title); - document.title = this.title; }, }; -- cgit v1.2.3