diff -r 7586b4a11c32 -r b2514a9bcd49 client/src/components/Sessions.js --- a/client/src/components/Sessions.js Tue Jun 20 12:11:57 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { bindActionCreators } from 'redux'; -import { Grid, Row, Col, ListGroup, ListGroupItem, Button } from 'react-bootstrap'; -import moment from 'moment'; -import '../App.css'; -import Navbar from './Navbar'; -import * as sessionsActions from '../actions/sessionsActions'; - -class Sessions extends Component { - - createSession = () => { - this.props.sessionsActions.createSession(); - } - - componentDidUpdate = () => { - if (this.props.currentSession) { - this.props.history.push('/sessions/' + this.props.currentSession._id) - } - } - - render() { - return ( -
- - - - - - {this.props.sessions.map((session) => - this.props.history.push('/sessions/' + session._id)}> - {session.title || 'No title'} {session._id} {moment(session.date).format('DD/MM/YYYY')} - - )} - - - - - -
- ); - } -} - -function mapStateToProps(state, props) { - return { - currentSession: state.get('currentSession'), - sessions: state.get('sessions') - }; -} - -function mapDispatchToProps(dispatch) { - return { - sessionsActions: bindActionCreators(sessionsActions, dispatch) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(Sessions);