FitTrackee/mpwo_client/src/components/Admin/AdminSports.jsx

51 lines
1.1 KiB
React
Raw Normal View History

2018-01-28 22:36:13 +01:00
import React from 'react'
import { Helmet } from 'react-helmet'
import { connect } from 'react-redux'
2018-04-29 18:23:46 +02:00
import { getData } from '../../actions/index'
2018-01-28 22:36:13 +01:00
class AdminSports extends React.Component {
2018-04-29 18:23:46 +02:00
componentDidMount() {
this.props.loadSport()
}
2018-01-28 22:36:13 +01:00
render() {
2018-04-29 18:23:46 +02:00
const { sports } = this.props
2018-01-28 22:36:13 +01:00
return (
<div>
<Helmet>
<title>mpwo - Admin</title>
</Helmet>
<h1 className="page-title">Administration - Sports</h1>
2018-04-29 18:23:46 +02:00
<div className="container">
<div className="row">
<div className="col-md-2" />
<div className="col-md-8 card">
<ul className="sport-items">
2018-04-29 18:23:46 +02:00
{sports.map(sport => (
<li key={sport.id}>
{sport.label}
</li>
))}
</ul>
</div>
<div className="col-md-2" />
</div>
</div>
2018-01-28 22:36:13 +01:00
</div>
)
}
}
export default connect(
state => ({
2018-04-29 18:23:46 +02:00
sports: state.sports.data,
2018-01-28 22:36:13 +01:00
user: state.user,
2018-04-29 18:23:46 +02:00
}),
dispatch => ({
loadSport: () => {
dispatch(getData('sports'))
},
2018-01-28 22:36:13 +01:00
})
)(AdminSports)