import { ref } from 'vue' import { useApi } from './useApi' const maintenanceEnabled = ref(false) export function useMaintenance() { const { apiCall } = useApi() const loading = ref(false) const fetchStatus = async () => { const res = await apiCall<{ enabled: boolean }>('/admin/maintenance') if (res.success && res.data) { maintenanceEnabled.value = res.data.enabled } } const toggle = async () => { loading.value = true try { const res = await apiCall<{ enabled: boolean }>('/admin/maintenance', { method: 'PUT' }) if (res.success && res.data) { maintenanceEnabled.value = res.data.enabled } } finally { loading.value = false } } return { maintenanceEnabled, loading, fetchStatus, toggle } }