From bf4d987fb84a70dbb0dff642123fd9a6f9187e83 Mon Sep 17 00:00:00 2001 From: jovuit Date: Tue, 5 Mar 2019 09:31:20 +0100 Subject: [PATCH] #511: Resolve "Page title not updated when changing the language" --- changes/changelog.d/511.bugfix | 1 + front/src/main.js | 31 ++++++++++--------------------- 2 files changed, 11 insertions(+), 21 deletions(-) create mode 100644 changes/changelog.d/511.bugfix diff --git a/changes/changelog.d/511.bugfix b/changes/changelog.d/511.bugfix new file mode 100644 index 000000000..0c4b61375 --- /dev/null +++ b/changes/changelog.d/511.bugfix @@ -0,0 +1 @@ +i18n: Update page title when changing the App's language. (#511) diff --git a/front/src/main.js b/front/src/main.js index fbe676106..9f058d8ec 100644 --- a/front/src/main.js +++ b/front/src/main.js @@ -57,28 +57,17 @@ Vue.use(GetTextPlugin, { Vue.use(VueMasonryPlugin) Vue.use(VueLazyload) Vue.config.productionTip = false -Vue.directive('title', { - inserted: (el, binding) => { - let parts = [] - let instanceName = store.state.instance.settings.instance.name.value - if (instanceName.length === 0) { - instanceName = 'Funkwhale' - } - parts.unshift(instanceName) - parts.unshift(binding.value) - document.title = parts.join(' - ') - }, - updated: (el, binding) => { - let parts = [] - let instanceName = store.state.instance.settings.instance.name.value - if (instanceName.length === 0) { - instanceName = 'Funkwhale' - } - parts.unshift(instanceName) - parts.unshift(binding.value) - document.title = parts.join(' - ') +Vue.directive('title', function (el, binding) { + let parts = [] + let instanceName = store.state.instance.settings.instance.name.value + if (instanceName.length === 0) { + instanceName = 'Funkwhale' } -}) + parts.unshift(instanceName) + parts.unshift(binding.value) + document.title = parts.join(' - ') + } +) axios.interceptors.request.use(function (config) { // Do something before request is sent if (store.state.auth.token) {