fix: custom locale not being set until the settings tab is open

This commit is contained in:
Roberto Tonino 2020-09-23 18:15:59 +02:00
parent 53735647f9
commit 0eb0ebcbc9
3 changed files with 22 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -21,10 +21,19 @@ import EventBus from '@/utils/EventBus.js'
/* ===== App initialization ===== */ /* ===== App initialization ===== */
function startApp() { function startApp() {
setLocale()
mountApp() mountApp()
initTabs() initTabs()
} }
function setLocale() {
let storedLocale = localStorage.getItem('locale')
if (storedLocale) {
i18n.locale = storedLocale
}
}
function mountApp() { function mountApp() {
new Vue({ new Vue({
store, store,
@ -120,11 +129,13 @@ socket.on('logged_in', function(data) {
break break
case -1: case -1:
toast(i18n.t('toasts.deezerNotAvailable'), 'close', true, 'login-toast') toast(i18n.t('toasts.deezerNotAvailable'), 'close', true, 'login-toast')
$('#open_login_prompt').show() return
document.getElementById('logged_in_info').classList.add('hide') // TODO
$('#settings_username').text('Not Logged') // $('#open_login_prompt').show()
$('#settings_picture').attr('src', `https://e-cdns-images.dzcdn.net/images/user/125x125-000000-80-0-0.jpg`) // document.getElementById('logged_in_info').classList.add('hide')
document.getElementById('home_not_logged_in').classList.remove('hide') // $('#settings_username').text('Not Logged')
// $('#settings_picture').attr('src', `https://e-cdns-images.dzcdn.net/images/user/125x125-000000-80-0-0.jpg`)
// document.getElementById('home_not_logged_in').classList.remove('hide')
} }
}) })

View File

@ -722,7 +722,6 @@ export default {
let storedLocale = localStorage.getItem('locale') let storedLocale = localStorage.getItem('locale')
if (storedLocale) { if (storedLocale) {
this.$i18n.locale = storedLocale
this.currentLocale = storedLocale this.currentLocale = storedLocale
} }