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.
Prowlarr/frontend/src/Settings/Indexers/Indexers/IndexersConnector.js

59 lines
1.1 KiB

import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { fetchIndexers, deleteIndexer } from 'Store/Actions/settingsActions';
import Indexers from './Indexers';
function createMapStateToProps() {
return createSelector(
(state) => state.settings.indexers,
(indexers) => {
return {
...indexers
};
}
);
}
const mapDispatchToProps = {
fetchIndexers,
deleteIndexer
};
class IndexersConnector extends Component {
//
// Lifecycle
componentDidMount() {
this.props.fetchIndexers();
}
//
// Listeners
onConfirmDeleteIndexer = (id) => {
this.props.deleteIndexer({ id });
}
//
// Render
render() {
return (
<Indexers
{...this.props}
onConfirmDeleteIndexer={this.onConfirmDeleteIndexer}
/>
);
}
}
IndexersConnector.propTypes = {
fetchIndexers: PropTypes.func.isRequired,
deleteIndexer: PropTypes.func.isRequired
};
export default connect(createMapStateToProps, mapDispatchToProps)(IndexersConnector);