forked from AkkomaGang/akkoma-fe
Change the async stuff to not render app before theme is loaded
This commit is contained in:
parent
9516d5dd73
commit
3fb531976a
4 changed files with 9 additions and 5 deletions
|
@ -55,7 +55,6 @@ const afterStoreSetup = ({ store, i18n }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
copyInstanceOption('nsfwCensorImage')
|
copyInstanceOption('nsfwCensorImage')
|
||||||
copyInstanceOption('theme')
|
|
||||||
copyInstanceOption('background')
|
copyInstanceOption('background')
|
||||||
copyInstanceOption('hidePostStats')
|
copyInstanceOption('hidePostStats')
|
||||||
copyInstanceOption('hideUserStats')
|
copyInstanceOption('hideUserStats')
|
||||||
|
@ -93,6 +92,9 @@ const afterStoreSetup = ({ store, i18n }) => {
|
||||||
store.dispatch('initializeSocket')
|
store.dispatch('initializeSocket')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return store.dispatch('setTheme', config['theme'])
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
const router = new VueRouter({
|
const router = new VueRouter({
|
||||||
mode: 'history',
|
mode: 'history',
|
||||||
routes: routes(store),
|
routes: routes(store),
|
||||||
|
|
|
@ -48,7 +48,7 @@ export default function createPersistedState ({
|
||||||
return getState(key, storage).then((savedState) => {
|
return getState(key, storage).then((savedState) => {
|
||||||
return store => {
|
return store => {
|
||||||
try {
|
try {
|
||||||
if (typeof savedState === 'object') {
|
if (savedState !== null && typeof savedState === 'object') {
|
||||||
// build user cache
|
// build user cache
|
||||||
const usersState = savedState.users || {}
|
const usersState = savedState.users || {}
|
||||||
usersState.usersObject = {}
|
usersState.usersObject = {}
|
||||||
|
|
|
@ -63,9 +63,11 @@ const instance = {
|
||||||
case 'name':
|
case 'name':
|
||||||
dispatch('setPageTitle')
|
dispatch('setPageTitle')
|
||||||
break
|
break
|
||||||
case 'theme':
|
|
||||||
setPreset(value, commit)
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
setTheme ({ commit }, themeName) {
|
||||||
|
commit('setInstanceOption', { name: 'theme', value: themeName })
|
||||||
|
return setPreset(themeName, commit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -480,7 +480,7 @@ const getThemes = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const setPreset = (val, commit) => {
|
const setPreset = (val, commit) => {
|
||||||
getThemes().then((themes) => {
|
return getThemes().then((themes) => {
|
||||||
const theme = themes[val] ? themes[val] : themes['pleroma-dark']
|
const theme = themes[val] ? themes[val] : themes['pleroma-dark']
|
||||||
const isV1 = Array.isArray(theme)
|
const isV1 = Array.isArray(theme)
|
||||||
const data = isV1 ? {} : theme.theme
|
const data = isV1 ? {} : theme.theme
|
||||||
|
|
Loading…
Reference in a new issue