mirror of
https://github.com/xpltdco/media-rip.git
synced 2026-04-03 02:53:58 -06:00
Theme init was running before config loaded, so admin theme settings were ignored (config was null). Now: init once immediately (from cookie or fallback), load config, init again with admin defaults. Theme persists correctly across all routes including /admin.
41 lines
1 KiB
Vue
41 lines
1 KiB
Vue
<script setup lang="ts">
|
|
import { onMounted } from 'vue'
|
|
import { useSSE } from '@/composables/useSSE'
|
|
import { useConfigStore } from '@/stores/config'
|
|
import { useDownloadsStore } from '@/stores/downloads'
|
|
import { useThemeStore } from '@/stores/theme'
|
|
import AppHeader from '@/components/AppHeader.vue'
|
|
import AppFooter from '@/components/AppFooter.vue'
|
|
|
|
const configStore = useConfigStore()
|
|
const downloadsStore = useDownloadsStore()
|
|
const themeStore = useThemeStore()
|
|
const { connect } = useSSE()
|
|
|
|
onMounted(async () => {
|
|
// Apply theme from cookie immediately to prevent flash-of-wrong-theme
|
|
themeStore.init()
|
|
// Then load server config and re-apply with admin defaults
|
|
await configStore.loadConfig()
|
|
themeStore.init()
|
|
await themeStore.loadCustomThemes()
|
|
await downloadsStore.fetchJobs()
|
|
connect()
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<div class="app-root">
|
|
<AppHeader />
|
|
<router-view />
|
|
<AppFooter />
|
|
</div>
|
|
</template>
|
|
|
|
<style>
|
|
.app-root {
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-height: 100vh;
|
|
}
|
|
</style>
|