Compare commits

...

5 Commits

Author SHA1 Message Date
eal 288a8edf9d Avoid theme reload 2017-09-04 17:28:49 +03:00
eal ff8e3b5458 Try to load saved theme when App created 2017-09-04 17:02:23 +03:00
eal 798af7bb5b Use different variable name for saved theme.
Seems to not work in Chromium without it, at least.
2017-09-03 18:18:11 +03:00
eal 39136c7a0b Fix error... 2017-09-03 15:26:00 +03:00
eal 93603a9c14 Add theme to persisted storage 2017-09-03 15:23:03 +03:00
3 changed files with 10 additions and 1 deletions

View File

@ -14,6 +14,12 @@ export default {
data: () => ({
mobileActivePanel: 'timeline'
}),
created () {
const savedTheme = this.$store.state.config.savedTheme
if (savedTheme && (savedTheme !== this.$store.config.theme)) {
this.$store.dispatch('setOption', { name: 'theme', value: savedTheme })
}
},
computed: {
currentUser () { return this.$store.state.users.currentUser },
background () {

View File

@ -14,6 +14,7 @@ export default {
watch: {
selected () {
this.$store.dispatch('setOption', { name: 'theme', value: this.selected })
this.$store.dispatch('setOption', { name: 'savedTheme', value: this.selected })
}
}
}

View File

@ -38,6 +38,7 @@ const persistedStateOptions = {
'config.autoLoad',
'config.hoverPreview',
'config.muteWords',
'config.savedTheme',
'statuses.notifications',
'users.users'
]
@ -89,8 +90,9 @@ new Vue({
window.fetch('/static/config.json')
.then((res) => res.json())
.then(({name, theme, background, logo, registrationOpen}) => {
const themeToSet = store.state.config.savedTheme || theme
store.dispatch('setOption', { name: 'name', value: name })
store.dispatch('setOption', { name: 'theme', value: theme })
store.dispatch('setOption', { name: 'theme', value: themeToSet })
store.dispatch('setOption', { name: 'background', value: background })
store.dispatch('setOption', { name: 'logo', value: logo })
store.dispatch('setOption', { name: 'registrationOpen', value: registrationOpen })