From 7fb137daf502cd2149f80d0a9922f0b3009d97b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=98=B8=EC=84=B1?= <68679792+HoSeong0731@users.noreply.github.com> Date: Wed, 8 Jul 2026 12:49:40 +0900 Subject: [PATCH] Add HealthComponent to display service health status --- src/components/HealthComponent.js | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/components/HealthComponent.js diff --git a/src/components/HealthComponent.js b/src/components/HealthComponent.js new file mode 100644 index 0000000..804fe6b --- /dev/null +++ b/src/components/HealthComponent.js @@ -0,0 +1,32 @@ +import React, { useEffect, useState } from 'react'; + +const HealthComponent = () => { + const [isHealthy, setIsHealthy] = useState(null); + + useEffect(() => { + const fetchHealth = async () => { + try { + const response = await fetch('/api/v1/health'); + const data = await response.json(); + setIsHealthy(data.status === 'healthy'); + } catch (error) { + setIsHealthy(false); + } + }; + fetchHealth(); + }, []); + + return ( +
+ {isHealthy === null ? ( + Loading... + ) : ( + + {isHealthy ? 'Healthy' : 'Unhealthy'} + + )} +
+ ); +}; + +export default HealthComponent; \ No newline at end of file