feat: vue-frontend-gerüst mit statusseite
Vue 3 + Vite + TypeScript, Pinia und Vue Router, ESLint und Prettier. Die Startseite zeigt den Healthcheck des Backends im dunklen Design. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8e6ef05304
commit
99307acf7d
18 files changed
+3846
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
|
||||
import { apiGet } from '@/api/client'
|
||||
|
||||
export interface Health {
|
||||
status: 'ok' | 'error'
|
||||
version: string
|
||||
db: 'ok' | 'error'
|
||||
}
|
||||
|
||||
export const useHealthStore = defineStore('health', () => {
|
||||
const health = ref<Health | null>(null)
|
||||
const error = ref<string | null>(null)
|
||||
const loading = ref(false)
|
||||
|
||||
async function refresh(): Promise<void> {
|
||||
loading.value = true
|
||||
error.value = null
|
||||
try {
|
||||
health.value = await apiGet<Health>('/health')
|
||||
} catch (e) {
|
||||
health.value = null
|
||||
error.value = e instanceof Error ? e.message : String(e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
return { health, error, loading, refresh }
|
||||
})
|
||||
Reference in new issue
Block a user