From e39673a1fa6ab415885cc4b20dd174d099125f77 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 10:59:24 +0900 Subject: [PATCH] Add HealthComponent to fetch and display health status --- src/components/HealthComponent.jsx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/components/HealthComponent.jsx diff --git a/src/components/HealthComponent.jsx b/src/components/HealthComponent.jsx new file mode 100644 index 0000000..e314c3b --- /dev/null +++ b/src/components/HealthComponent.jsx @@ -0,0 +1,28 @@ +import React, { useEffect, useState } from 'react'; + +const HealthComponent = () => { + const [isHealthy, setIsHealthy] = useState(null); + + useEffect(() => { + const fetchHealth = async () => { + const response = await fetch('/api/v1/health'); + const data = await response.json(); + setIsHealthy(data.healthy); + }; + fetchHealth(); + }, []); + + return ( +
+ {isHealthy === null ? ( + Loading... + ) : ( + + {isHealthy ? 'Healthy' : 'Unhealthy'} + + )} +
+ ); +}; + +export default HealthComponent; \ No newline at end of file