feat(platform): poll topbar link health
This commit is contained in:
@@ -15,17 +15,25 @@ export default function App() {
|
||||
const [activeVin, setActiveVin] = useState('LB9A32A24R0LS1426');
|
||||
const [linkIssueCount, setLinkIssueCount] = useState<number | null>(null);
|
||||
|
||||
const refreshOpsHealth = useCallback(() => {
|
||||
const refreshOpsHealth = useCallback((showError = true) => {
|
||||
return api.opsHealth()
|
||||
.then((health) => {
|
||||
setLinkIssueCount(health.linkHealth.filter((item) => item.status !== 'ok').length);
|
||||
return health;
|
||||
})
|
||||
.catch((error: Error) => Toast.error(error.message));
|
||||
.catch((error: Error) => {
|
||||
if (showError) {
|
||||
Toast.error(error.message);
|
||||
}
|
||||
});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
refreshOpsHealth();
|
||||
const timer = window.setInterval(() => {
|
||||
refreshOpsHealth(false);
|
||||
}, 60000);
|
||||
return () => window.clearInterval(timer);
|
||||
}, [refreshOpsHealth]);
|
||||
|
||||
const openVehicle = (vin: string) => {
|
||||
|
||||
Reference in New Issue
Block a user