summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkirankumarb07 <kirankumarb@ami.com>2023-03-09 15:47:58 +0300
committerKiran Kumar Ballapalli <kirankumarb@ami.com>2023-03-15 09:18:38 +0300
commit5d95418ca32de5060a7521fef7b57b95cc262352 (patch)
treec60a273a5a3a4ea6cc9b4f0b473217739aee2f91
parent373d243c98f8b465e9315e95f88cdf26b887a626 (diff)
downloadwebui-vue-5d95418ca32de5060a7521fef7b57b95cc262352.tar.xz
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 <kirankumarb@ami.com>
-rw-r--r--src/components/Global/PageTitle.vue24
1 files changed, 13 insertions, 11 deletions
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;
},
};
</script>