@@ -94,17 +94,20 @@ export function useDashboardHealthQuery(): DashboardHealthQueryState {
|
||||
status: 'loading'
|
||||
});
|
||||
|
||||
const refresh = useCallback(() => {
|
||||
setState({ checks: null, error: null, status: 'loading' });
|
||||
|
||||
const loadHealth = useCallback(() => {
|
||||
getDashboardHealth()
|
||||
.then((checks) => setState({ checks, error: null, status: 'success' }))
|
||||
.catch((error: unknown) => setState({ checks: null, error: messageFromError(error), status: 'error' }));
|
||||
}, []);
|
||||
|
||||
const refresh = useCallback(() => {
|
||||
setState({ checks: null, error: null, status: 'loading' });
|
||||
loadHealth();
|
||||
}, [loadHealth]);
|
||||
|
||||
useEffect(() => {
|
||||
refresh();
|
||||
}, [refresh]);
|
||||
loadHealth();
|
||||
}, [loadHealth]);
|
||||
|
||||
if (state.status === 'success') {
|
||||
return { checks: state.checks, error: null, refresh, status: 'success' };
|
||||
|
||||
Reference in New Issue
Block a user