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.
Readarr/frontend/src/Author/Delete/DeleteAuthorModalContentCon...

57 lines
1.3 KiB

import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { deleteAuthor } from 'Store/Actions/authorActions';
import createAuthorSelector from 'Store/Selectors/createAuthorSelector';
import DeleteAuthorModalContent from './DeleteAuthorModalContent';
function createMapStateToProps() {
return createSelector(
createAuthorSelector(),
(author) => {
return author;
}
);
}
const mapDispatchToProps = {
deleteAuthor
};
class DeleteAuthorModalContentConnector extends Component {
//
// Listeners
onDeletePress = (deleteFiles, addImportListExclusion) => {
this.props.deleteAuthor({
id: this.props.authorId,
deleteFiles,
addImportListExclusion
});
this.props.onModalClose(true);
};
//
// Render
render() {
return (
<DeleteAuthorModalContent
{...this.props}
onDeletePress={this.onDeletePress}
/>
);
}
}
DeleteAuthorModalContentConnector.propTypes = {
authorId: PropTypes.number.isRequired,
onModalClose: PropTypes.func.isRequired,
deleteAuthor: PropTypes.func.isRequired
};
export default connect(createMapStateToProps, mapDispatchToProps)(DeleteAuthorModalContentConnector);