equal
deleted
inserted
replaced
4 import { Grid, Row, Col, ListGroup, ListGroupItem, Button } from 'react-bootstrap'; |
4 import { Grid, Row, Col, ListGroup, ListGroupItem, Button } from 'react-bootstrap'; |
5 import moment from 'moment'; |
5 import moment from 'moment'; |
6 import '../App.css'; |
6 import '../App.css'; |
7 import Navbar from './Navbar'; |
7 import Navbar from './Navbar'; |
8 import * as sessionsActions from '../actions/sessionsActions'; |
8 import * as sessionsActions from '../actions/sessionsActions'; |
9 import uuidV1 from 'uuid/v1'; |
|
10 |
9 |
11 class Sessions extends Component { |
10 class Sessions extends Component { |
12 |
11 |
13 createSession = () => { |
12 createSession = () => { |
14 const sessionId = uuidV1(); |
13 this.props.sessionsActions.createSession(); |
15 this.props.sessionsActions.createSession(sessionId); |
14 } |
16 this.props.history.push('/sessions/' + sessionId); |
15 |
|
16 componentDidUpdate = () => { |
|
17 if (this.props.currentSession) { |
|
18 this.props.history.push('/sessions/' + this.props.currentSession._id) |
|
19 } |
17 } |
20 } |
18 |
21 |
19 render() { |
22 render() { |
20 return ( |
23 return ( |
21 <div> |
24 <div> |
41 } |
44 } |
42 } |
45 } |
43 |
46 |
44 function mapStateToProps(state, props) { |
47 function mapStateToProps(state, props) { |
45 return { |
48 return { |
46 // currentSession: state.get('currentSession'), |
49 currentSession: state.get('currentSession'), |
47 // sessions: state.get('sessions') |
50 sessions: state.get('sessions') |
48 sessions: state['sessions'] |
|
49 }; |
51 }; |
50 } |
52 } |
51 |
53 |
52 function mapDispatchToProps(dispatch) { |
54 function mapDispatchToProps(dispatch) { |
53 return { |
55 return { |