diff --git a/src/components/HealthComponent.jsx b/src/components/HealthComponent.jsx new file mode 100644 index 0000000..380eefd --- /dev/null +++ b/src/components/HealthComponent.jsx @@ -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.healthy); + } catch (error) { + setIsHealthy(false); + } + }; + fetchHealth(); + }, []); + + return ( +
+ {isHealthy === null ? ( + Loading... + ) : ( + + {isHealthy ? 'Healthy' : 'Unhealthy'} + + )} +
+ ); +}; + +export default HealthComponent; \ No newline at end of file