import { defineStore } from 'pinia' import { ref } from 'vue' import { api } from '@/api/client' export interface Health { status: 'ok' | 'error' version: string db: 'ok' | 'error' } export const useHealthStore = defineStore('health', () => { const health = ref(null) const error = ref(null) const loading = ref(false) async function refresh(): Promise { loading.value = true error.value = null try { health.value = await api.get('/health') } catch (e) { health.value = null error.value = e instanceof Error ? e.message : String(e) } finally { loading.value = false } } return { health, error, loading, refresh } })