-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added health check button to landing page
- Changed Backend URL
- Loading branch information
Showing
3 changed files
with
63 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
VITE_BACKEND_URL=http://backend.default.svc.cluster.local:8081 | ||
VITE_BACKEND_URL=http://poll-manager:8081 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
|
||
|
||
interface HealthCheckResponse { | ||
status: string; | ||
} | ||
|
||
function HealthCheckButton() { | ||
const [healthStatus, setHealthStatus] = useState<string | null>(null); | ||
|
||
const fetchHealthStatus = async () => { | ||
try { | ||
const response = await fetch('http://poll-manager:8081/api/poll/health'); | ||
const data: HealthCheckResponse = await response.json(); | ||
setHealthStatus(data.status); | ||
} catch (error) { | ||
console.error('Error fetching health status:', error); | ||
setHealthStatus('Error fetching health status'); | ||
} | ||
}; | ||
|
||
return ( | ||
<div> | ||
<button onClick={fetchHealthStatus}>Check Health</button> | ||
<header>Health Status: {healthStatus || 'Not checked yet'}</header> | ||
</div> | ||
); | ||
} | ||
export default HealthCheckButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters