--- a/client/src/components/Sessions.js Mon Jun 19 18:32:27 2017 +0200
+++ b/client/src/components/Sessions.js Mon Jun 19 21:37:33 2017 +0200
@@ -6,17 +6,14 @@
import '../App.css';
import Navbar from './Navbar';
import * as sessionsActions from '../actions/sessionsActions';
+import uuidV1 from 'uuid/v1';
class Sessions extends Component {
createSession = () => {
- this.props.sessionsActions.createSession();
- }
-
- componentDidUpdate = () => {
- if (this.props.currentSession) {
- this.props.history.push('/sessions/' + this.props.currentSession._id)
- }
+ const sessionId = uuidV1();
+ this.props.sessionsActions.createSession(sessionId);
+ this.props.history.push('/sessions/' + sessionId);
}
render() {
@@ -46,8 +43,9 @@
function mapStateToProps(state, props) {
return {
- currentSession: state.get('currentSession'),
- sessions: state.get('sessions')
+ // currentSession: state.get('currentSession'),
+ // sessions: state.get('sessions')
+ sessions: state['sessions']
};
}