Fix user preferences not being applied correctly after sign-in

This commit is contained in:
Bubka
2023-03-15 11:46:37 +01:00
parent 5ced8cbf0e
commit f359a1ade3
9 changed files with 70 additions and 22 deletions

View File

@ -1,4 +1,5 @@
import Vue from 'vue'
import i18n from './langs/i18n'
Vue.mixin({
@ -100,7 +101,23 @@ Vue.mixin({
setTheme(theme) {
document.documentElement.dataset.theme = theme;
}
},
applyPreferences(preferences) {
for (const preference in preferences) {
try {
this.$root.userPreferences[preference] = preferences[preference]
}
catch (e) {
console.log(e)
}
}
if (this.$root.userPreferences.lang != 'browser') {
i18n.locale = this.$root.userPreferences.lang
document.documentElement.lang = this.$root.userPreferences.lang
}
},
}
})