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(() => {
|
||||
// Timer to call getHealth every 5 seconds
|
||||
const timer = setInterval(() => {
|
||||
getHealth().catch((e) => {
|
||||
setFetchError(true);
|
||||
});
|
||||
getHealth()
|
||||
.then(() => {
|
||||
if (fetchError) setFetchError(false);
|
||||
})
|
||||
.catch(() => {
|
||||
setFetchError(true);
|
||||
});
|
||||
}, 5000);
|
||||
|
||||
// Clean up the timer on component unmount
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue