1
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

19 lines
691 B

import { StateHistoryItem } from 'app/types/unified-alerting';
import { useEffect } from 'react';
import { useDispatch } from 'react-redux';
import { fetchGrafanaAnnotationsAction } from '../state/actions';
import { AsyncRequestState } from '../utils/redux';
import { useUnifiedAlertingSelector } from './useUnifiedAlertingSelector';
export function useManagedAlertStateHistory(alertId: string) {
const dispatch = useDispatch();
const history = useUnifiedAlertingSelector<AsyncRequestState<StateHistoryItem[]>>(
(state) => state.managedAlertStateHistory
);
useEffect(() => {
dispatch(fetchGrafanaAnnotationsAction(alertId));
}, [dispatch, alertId]);
return history;
}