mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-29 01:15:48 +02:00
25 lines
788 B
JavaScript
25 lines
788 B
JavaScript
import { connect } from 'react-redux';
|
|
import StrategiesListComponent from './list-component.jsx';
|
|
import { fetchStrategies, removeStrategy } from '../../store/strategy-actions';
|
|
|
|
const mapStateToProps = (state) => {
|
|
const list = state.strategies.get('list').toArray();
|
|
|
|
return {
|
|
strategies: list,
|
|
};
|
|
};
|
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
removeStrategy: (strategy) => {
|
|
if (window.confirm('Are you sure you want to remove this strategy?')) { // eslint-disable-line no-alert
|
|
removeStrategy(strategy)(dispatch);
|
|
}
|
|
},
|
|
fetchStrategies: () => fetchStrategies()(dispatch),
|
|
});
|
|
|
|
const StrategiesListContainer = connect(mapStateToProps, mapDispatchToProps)(StrategiesListComponent);
|
|
|
|
export default StrategiesListContainer;
|