client/src/components/SessionList.js
changeset 168 ea92f4fe783d
parent 162 1fd73fdaf4c6
child 170 7da1d5137b0b
--- a/client/src/components/SessionList.js	Tue Oct 09 19:07:47 2018 +0200
+++ b/client/src/components/SessionList.js	Mon Oct 08 18:35:47 2018 +0200
@@ -65,7 +65,7 @@
 
   emptyListMessage = () => {
 
-      if (this.props.sessions.size === 0) {
+      if (this.props.sessions.length === 0) {
       return (
        <h1 className="text-primary text-center mt-5 pt-5">vous n'avez créé aucune session pour le moment</h1>
       );
@@ -75,7 +75,7 @@
   deleteSession = () => {
     const { sessionToDelete } = this.state;
 
-    this.props.sessionsActions.deleteSession(sessionToDelete);
+    this.props.sessionsActions.deleteSession(sessionToDelete._id);
 
     this.setState({
       modalIsOpen: false,
@@ -94,17 +94,17 @@
           </div>
           <div className="row mt-5 justify-content-start">
                 {this.props.sessions.map((session) =>
-                  <div className="session col-lg-3" key={session.get('_id')}>
+                  <div className="session col-lg-3" key={session._id}>
                       <div className="col-md-auto w-100 m-2 p-2">
-                        <a className="sessions" onClick={() => this.props.history.push('/sessions/' + session.get('_id'))}>
+                        <a className="sessions" onClick={() => this.props.history.push('/sessions/' + session._id)}>
                           <span className="session-title text-primary">{session.title || 'Session sans titre'}<br /></span>
-                          <span className="session-date text-muted">{moment(session.get('date')).format('DD/MM/YYYY')}<br /></span>
+                          <span className="session-date text-muted">{moment(session.date).format('DD/MM/YYYY')}<br /></span>
                           <span className="session-description">{session.description}<br /></span>
                         </a>
                         <button type="button" id="delete" className="btn btn-link float-left" onClick={ this.onClickDelete.bind(this, session) }>
                           <span className="material-icons delete text-dark">delete</span>
                         </button>
-                        <button type="button" className="btn btn-link float-left" onClick={() => this.props.history.push('/read-only/' + session.get('_id'))}>
+                        <button type="button" className="btn btn-link float-left" onClick={() => this.props.history.push('/read-only/' + session._id)}>
                           <span className="material-icons delete text-dark">remove_red_eye</span>
                         </button>
                       </div>