|
@@ -61,7 +61,12 @@ if (Meteor.isClient) {
|
|
|
alert("You need to login first.");
|
|
|
}
|
|
|
else {
|
|
|
- Meteor.call("addDoc");
|
|
|
+ Meteor.call("addDoc", function (err, res) {
|
|
|
+ if (!err) {
|
|
|
+ console.log("addDoc res", res);
|
|
|
+ Session.set("docid", res);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -90,7 +95,8 @@ Meteor.methods({
|
|
|
createdOn: new Date(),
|
|
|
title: "my new doc"
|
|
|
};
|
|
|
- Documents.insert(doc);
|
|
|
+ const docid = Documents.insert(doc);
|
|
|
+ return docid;
|
|
|
}
|
|
|
},
|
|
|
|