client/src/components/CreateSession.js
changeset 168 ea92f4fe783d
parent 167 1f340f3597a8
child 171 03334a31130a
equal deleted inserted replaced
167:1f340f3597a8 168:ea92f4fe783d
     7 
     7 
     8 export default class CreateSession extends Component {
     8 export default class CreateSession extends Component {
     9 
     9 
    10   static propTypes = {
    10   static propTypes = {
    11     history: PropTypes.object.isRequired,
    11     history: PropTypes.object.isRequired,
    12     group: PropTypes.object.isRequired,
    12     group: PropTypes.object,
    13     createSession: PropTypes.func.isRequired,
    13     createSession: PropTypes.func.isRequired,
    14   };
    14   };
    15 
    15 
    16   state = {
    16   state = {
    17     createGroup: false,
    17     createGroup: false,
    29     this.setState({modalIsOpen: true});
    29     this.setState({modalIsOpen: true});
    30   }
    30   }
    31 
    31 
    32   createSession = () => {
    32   createSession = () => {
    33     const sessionId = uuidV1();
    33     const sessionId = uuidV1();
    34     const groupName = this.props.group ? this.props.group.get('name') : null;
    34     const groupName = this.props.group ? this.props.group.name : null;
    35     const protocol = this.props.group ? this.props.group.get('protocol') : null;
    35     const protocol = this.props.group ? this.props.group.protocol : null;
    36     const {title, description} = this.state;
    36     const {title, description} = this.state;
    37 
    37 
    38     this.props.createSession(sessionId, groupName, protocol, title, description);
    38     this.props.createSession(sessionId, groupName, protocol, title, description);
    39     this.props.history.push('/sessions/' + sessionId);
    39     this.props.history.push('/sessions/' + sessionId);
    40   }
    40   }