Fix react router
This commit is contained in:
committed by
Amine Ben hammou
parent
3831f127c1
commit
b6dd13c5c0
@@ -280,7 +280,10 @@ Selection.propTypes = {
|
||||
onValueChange: PropTypes.func,
|
||||
field: PropTypes.shape({
|
||||
name: PropTypes.string.isRequired,
|
||||
values: PropTypes.object,
|
||||
values: PropTypes.oneOfType([
|
||||
PropTypes.object,
|
||||
PropTypes.array,
|
||||
]),
|
||||
getLabel: PropTypes.func,
|
||||
resetSelect2OnUpdate: PropTypes.bool,
|
||||
selected: PropTypes.func,
|
||||
@@ -297,7 +300,7 @@ Selection.propTypes = {
|
||||
disabled: PropTypes.bool,
|
||||
validation: PropTypes.object,
|
||||
}).isRequired,
|
||||
item: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
||||
item: PropTypes.object, // eslint-disable-line react/forbid-prop-types
|
||||
disabled: PropTypes.bool,
|
||||
width: PropTypes.string,
|
||||
};
|
||||
@@ -308,6 +311,7 @@ Selection.defaultProps = {
|
||||
},
|
||||
disabled: false,
|
||||
width: '',
|
||||
item: undefined,
|
||||
};
|
||||
|
||||
|
||||
|
@@ -111,6 +111,7 @@ if (container) {
|
||||
component={route.component}
|
||||
name={route.name || null}
|
||||
data={route.data || null}
|
||||
render={route.render}
|
||||
/>
|
||||
))}
|
||||
</Switch>
|
||||
|
@@ -4,11 +4,12 @@ import AutomaticEmailEvent from 'newsletters/types/automatic_emails/event.jsx';
|
||||
import MailPoet from 'mailpoet';
|
||||
import _ from 'underscore';
|
||||
import PropTypes from 'prop-types';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
|
||||
class AutomaticEmailEventsList extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.email = this.props.route.data.email;
|
||||
this.email = this.props.email;
|
||||
this.emailEvents = this.email.events;
|
||||
this.eventsConfigurator = this.eventsConfigurator.bind(this);
|
||||
}
|
||||
@@ -19,7 +20,7 @@ class AutomaticEmailEventsList extends React.Component {
|
||||
'MailPoet Premium version': window.mailpoet_premium_version,
|
||||
'Email type': eventSlug,
|
||||
});
|
||||
this.props.router.push(`new/${this.email.slug}/${eventSlug}/conditions`);
|
||||
this.props.history.push(`/new/${this.email.slug}/${eventSlug}/conditions`);
|
||||
}
|
||||
|
||||
displayEvents() {
|
||||
@@ -59,18 +60,14 @@ class AutomaticEmailEventsList extends React.Component {
|
||||
}
|
||||
|
||||
AutomaticEmailEventsList.propTypes = {
|
||||
route: PropTypes.shape({
|
||||
data: PropTypes.shape({
|
||||
email: PropTypes.shape({
|
||||
title: PropTypes.string.isRequired,
|
||||
slug: PropTypes.string.isRequired,
|
||||
premium: PropTypes.bool,
|
||||
}).isRequired,
|
||||
}).isRequired,
|
||||
}).isRequired,
|
||||
router: PropTypes.shape({
|
||||
history: PropTypes.shape({
|
||||
push: PropTypes.func.isRequired,
|
||||
}).isRequired,
|
||||
};
|
||||
|
||||
module.exports = AutomaticEmailEventsList;
|
||||
module.exports = withRouter(AutomaticEmailEventsList);
|
||||
|
Reference in New Issue
Block a user