media-rip/frontend/src/stores/config.ts
xpltd efc2ead796 M001: media.rip() v1.0 — complete application
Full-featured self-hosted yt-dlp web frontend:
- Python 3.12+ / FastAPI backend with async SQLite, SSE transport, session isolation
- Vue 3 / TypeScript / Pinia frontend with real-time progress, theme picker
- 3 built-in themes (cyberpunk/dark/light) + drop-in custom theme system
- Admin auth (bcrypt), purge system, cookie upload, file serving
- Docker multi-stage build, GitHub Actions CI/CD
- 179 backend tests, 29 frontend tests (208 total)

Slices: S01 (Foundation), S02 (SSE+Sessions), S03 (Frontend),
        S04 (Admin+Auth), S05 (Themes), S06 (Docker+CI)
2026-03-18 20:00:17 -05:00

33 lines
777 B
TypeScript

/**
* Config Pinia store — loads and caches public configuration.
*/
import { ref } from 'vue'
import { defineStore } from 'pinia'
import { api } from '@/api/client'
import type { PublicConfig } from '@/api/types'
export const useConfigStore = defineStore('config', () => {
const config = ref<PublicConfig | null>(null)
const isLoading = ref(false)
const error = ref<string | null>(null)
async function loadConfig(): Promise<void> {
isLoading.value = true
error.value = null
try {
config.value = await api.getPublicConfig()
} catch (err: any) {
error.value = err.message || 'Failed to load configuration'
} finally {
isLoading.value = false
}
}
return {
config,
isLoading,
error,
loadConfig,
}
})