mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-28 17:55:15 +02:00
26 lines
711 B
JavaScript
26 lines
711 B
JavaScript
import { connect } from 'react-redux';
|
|
import HistoryListToggleComponent from './history-list-toggle-component';
|
|
import { fetchHistoryForToggle } from '../../store/history-actions';
|
|
|
|
function getHistoryFromToggle (state, toggleName) {
|
|
if (!toggleName) {
|
|
return [];
|
|
}
|
|
|
|
if (state.history.hasIn(['toggles', toggleName])) {
|
|
return state.history.getIn(['toggles', toggleName]).toArray();
|
|
}
|
|
|
|
return [];
|
|
}
|
|
|
|
const mapStateToProps = (state, props) => ({
|
|
history: getHistoryFromToggle(state, props.toggleName),
|
|
});
|
|
|
|
const HistoryListToggleContainer = connect(mapStateToProps, {
|
|
fetchHistoryForToggle,
|
|
})(HistoryListToggleComponent);
|
|
|
|
export default HistoryListToggleContainer;
|