[#FER-19] Ajouter le healthCheck du pont bascule #58

Merged
tristan merged 12 commits from feature/FER-19-ajouter-le-healthcheck-du-pont-bascule into develop 2026-05-21 12:38:33 +00:00
Showing only changes of commit 8a66336da3 - Show all commits

View File

@@ -0,0 +1,23 @@
import { ref } from 'vue'
import { useApi } from '~/composables/useApi'
export type PontBasculeStatus = 'checking' | 'connected' | 'disconnected'
export const usePontBascule = () => {
const api = useApi()
const status = ref<PontBasculeStatus>('checking')
const checkHealth = async () => {
status.value = 'checking'
try {
const res = await api.get<{ healthy: boolean }>('pont_bascule/health', {}, {
toast: false
})
status.value = res.healthy ? 'connected' : 'disconnected'
} catch {
status.value = 'disconnected'
}
}
return { status, checkHealth }
}