if health returns, the fetchError error is removed
This commit is contained in:
parent
4e29a92657
commit
18b2f5e970
1 changed files with 7 additions and 3 deletions
|
|
@ -150,9 +150,13 @@ export default function App() {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Timer to call getHealth every 5 seconds
|
// Timer to call getHealth every 5 seconds
|
||||||
const timer = setInterval(() => {
|
const timer = setInterval(() => {
|
||||||
getHealth().catch((e) => {
|
getHealth()
|
||||||
setFetchError(true);
|
.then(() => {
|
||||||
});
|
if (fetchError) setFetchError(false);
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
setFetchError(true);
|
||||||
|
});
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
// Clean up the timer on component unmount
|
// Clean up the timer on component unmount
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue