Sha256: 50761ce7eab5fccc6951b50610740848dc17d3428c83204c1125f2e5f2bfc05b
Contents?: true
Size: 1 KB
Versions: 6
Compression:
Stored size: 1 KB
Contents
import React, { useEffect } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { stopInterval } from 'foremanReact/redux/middlewares/IntervalMiddleware'; import TargetingHosts from './TargetingHosts'; import { selectItems, selectStatus, selectAutoRefresh, } from './TargetingHostsSelectors'; import { getData } from './TargetingHostsActions'; import { TARGETING_HOSTS } from './TargetingHostsConsts'; const WrappedTargetingHosts = () => { const dispatch = useDispatch(); const autoRefresh = useSelector(selectAutoRefresh); const items = useSelector(selectItems); const status = useSelector(selectStatus); useEffect(() => { dispatch(getData()); return () => { dispatch(stopInterval(TARGETING_HOSTS)); }; }, [dispatch]); useEffect(() => { if (autoRefresh === 'false') { dispatch(stopInterval(TARGETING_HOSTS)); } }, [autoRefresh, dispatch]); return <TargetingHosts status={status} items={items} />; }; export default WrappedTargetingHosts;
Version data entries
6 entries across 6 versions & 1 rubygems