Pārlūkot izejas kodu

Step 11.4: Update renderTasks to pass in showPrivateButton.

Frederic G. MARAND 8 gadi atpakaļ
vecāks
revīzija
04a4e9c1c6
1 mainītis faili ar 9 papildinājumiem un 1 dzēšanām
  1. 9 1
      App.jsx

+ 9 - 1
App.jsx

@@ -34,9 +34,17 @@ App = React.createClass({
   },
 
   renderTasks() {
+    // Get tasks from this.data.tasks.
     return this.data.tasks.map((task) => {
+      const currentUserId = this.data.currentUser && this.data.currentUser._id;
+      const showPrivateButton = task.owner === currentUserId;
+
       // Meteor._debug(task._id);
-      return <Task key={task._id} task={task} />;
+      return <Task
+        key={task._id}
+        task={task}
+        showPrivateButton={showPrivateButton}
+      />;
     });
   },