🐛 Fixes applying local themes to multi-pages (#774)

This commit is contained in:
Alicia Sykes
2022-06-30 23:21:48 +01:00
parent a2442c7349
commit ebf9c1f91a
3 changed files with 25 additions and 5 deletions

View File

@@ -41,6 +41,7 @@ const HomeMixin = {
watch: {
async $route() {
await this.getConfigForRoute();
this.setTheme();
},
},
methods: {
@@ -52,8 +53,17 @@ const HomeMixin = {
this.$store.commit(Keys.USE_MAIN_CONFIG);
}
},
/* TEMPORARY: If on sub-page, check if custom theme is set and return it */
getSubPageTheme() {
if (!this.pageId || this.pageId === 'home') {
return null;
} else {
const themeStoreKey = `${localStorageKeys.THEME}-${this.pageId}`;
return localStorage[themeStoreKey] || null;
}
},
setTheme() {
const theme = GetTheme();
const theme = this.getSubPageTheme() || GetTheme();
ApplyLocalTheme(theme);
ApplyCustomVariables(theme);
},