diff --git a/client/plugins/i18n.js b/client/plugins/i18n.js index 30f01ab4..39eb7a09 100644 --- a/client/plugins/i18n.js +++ b/client/plugins/i18n.js @@ -84,7 +84,7 @@ async function loadi18n(code) { Vue.prototype.$setDateFnsLocale(languageCodeMap[code].dateFnsLocale) - this.$eventBus.$emit('change-lang', code) + this?.$eventBus?.$emit('change-lang', code) return true } diff --git a/client/plugins/init.client.js b/client/plugins/init.client.js index a16e6fa1..cbf514fd 100644 --- a/client/plugins/init.client.js +++ b/client/plugins/init.client.js @@ -156,14 +156,14 @@ Vue.prototype.$copyToClipboard = (str, ctx) => { } function xmlToJson(xml) { - const json = {}; + const json = {} for (const res of xml.matchAll(/(?:<(\w*)(?:\s[^>]*)*>)((?:(?!<\1).)*)(?:<\/\1>)|<(\w*)(?:\s*)*\/>/gm)) { - const key = res[1] || res[3]; - const value = res[2] && xmlToJson(res[2]); - json[key] = ((value && Object.keys(value).length) ? value : res[2]) || null; + const key = res[1] || res[3] + const value = res[2] && xmlToJson(res[2]) + json[key] = ((value && Object.keys(value).length) ? value : res[2]) || null } - return json; + return json } Vue.prototype.$xmlToJson = xmlToJson