diff --git a/src/components/HealthComponent.jsx b/src/components/HealthComponent.jsx new file mode 100644 index 0000000..40a4368 --- /dev/null +++ b/src/components/HealthComponent.jsx @@ -0,0 +1,33 @@ +import React, { useEffect, useState } from 'react'; + +const HealthComponent = () => { + const [health, setHealth] = useState(null); + + useEffect(() => { + const fetchHealth = async () => { + try { + const response = await fetch('/api/v1/health'); + const data = await response.json(); + setHealth(data.healthy); + } catch (error) { + console.error('Error fetching health status', error); + setHealth(false); + } + }; + fetchHealth(); + }, []); + + return ( +
+ {health !== null && ( + + {health ? 'Healthy' : 'Unhealthy'} + + )} +
+ ); +}; + +export default HealthComponent; \ No newline at end of file