1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-28 17:55:15 +02:00
unleash.unleash/frontend/src/component/history/history-list-toggle-container.jsx
2016-12-05 18:11:51 +01:00

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;