From 8a66336da3e00f08645b78dc786e984eff7e3c11 Mon Sep 17 00:00:00 2001 From: tristan Date: Thu, 21 May 2026 14:16:59 +0200 Subject: [PATCH] feat(fer-19) : composable usePontBascule Co-Authored-By: Claude Opus 4.7 (1M context) --- frontend/composables/usePontBascule.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 frontend/composables/usePontBascule.ts diff --git a/frontend/composables/usePontBascule.ts b/frontend/composables/usePontBascule.ts new file mode 100644 index 0000000..578bd3a --- /dev/null +++ b/frontend/composables/usePontBascule.ts @@ -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('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 } +}