FitTrackee/mpwo_client/src/components/Activities/ActivityAdd.jsx

39 lines
720 B
React
Raw Normal View History

2018-05-01 19:29:21 +02:00
import React from 'react'
import { connect } from 'react-redux'
2018-05-10 17:21:19 +02:00
import ActivityAddOrEdit from './ActivityAddOrEdit'
2018-05-01 19:29:21 +02:00
import { getData } from '../../actions/index'
2018-05-10 17:21:19 +02:00
class ActivityAdd extends React.Component {
2018-05-01 19:29:21 +02:00
componentDidMount() {
this.props.loadSports()
}
render() {
2018-05-08 16:42:10 +02:00
const { message, sports } = this.props
2018-05-01 19:29:21 +02:00
return (
<div>
2018-05-10 17:21:19 +02:00
<ActivityAddOrEdit
activity={null}
message={message}
sports={sports}
/>
2018-05-01 19:29:21 +02:00
</div>
)
}
}
export default connect(
state => ({
message: state.message,
sports: state.sports.data,
user: state.user,
}),
dispatch => ({
loadSports: () => {
dispatch(getData('sports'))
},
})
2018-05-10 17:21:19 +02:00
)(ActivityAdd)