瀏覽代碼

Step 9.5: Update insert to save username and owner.

Frederic G. MARAND 9 年之前
父節點
當前提交
d6ccabc446
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      App.jsx

+ 3 - 1
App.jsx

@@ -48,7 +48,9 @@ App = React.createClass({
 
     Tasks.insert({
       text: text,
-      createdAt: new Date() // Current time
+      createdAt: new Date(),           // Current time
+      owner: Meteor.userId(),          // _id of logged-in user
+      username: Meteor.user().username // username of logged-in user
     });
 
     // Clear form to allow a new input.