final push for themes

This commit is contained in:
Tiago vasconcelos
2021-07-01 12:34:50 +01:00
parent 2cd6877645
commit 277460edb7
4 changed files with 20 additions and 14 deletions
+13 -7
View File
@@ -334,18 +334,24 @@ window.windowMixin = {
},
created: function () {
this.$q.dark.set(this.$q.localStorage.getItem('lnbits.darkMode'))
this.g.allowedThemes = window.allowedThemes
let theme = this.$q.localStorage.getItem('lnbits.theme')
this.g.allowedThemes = window.allowedThemes ?? ['classic']
// failsafe if admin changes themes halfway
if (theme && !this.g.allowedThemes.includes(theme)) {
if (
this.$q.localStorage.getItem('lnbits.theme') &&
!this.g.allowedThemes.includes(
this.$q.localStorage.getItem('lnbits.theme')
)
) {
console.log('allowedThemes changed by Admin', this.g.allowedThemes[0])
this.changeColor(this.g.allowedThemes[0] || 'classic')
this.changeColor(this.g.allowedThemes[0])
}
if (theme) {
document.body.setAttribute('data-theme', theme)
if (this.$q.localStorage.getItem('lnbits.theme')) {
document.body.setAttribute(
'data-theme',
this.$q.localStorage.getItem('lnbits.theme')
)
}
if (window.user) {