12345678910111213141516171819202122232425262728293031323334353637383940 |
- Tasks = new Mongo.Collection('tasks');
- if (Meteor.isClient) {
-
- Accounts.ui.config({
- passwordSignupFields: "USERNAME_ONLY"
- });
- Meteor.startup(function () {
-
- ReactDOM.render(<App />, document.getElementById('render-target'));
- });
- }
- Meteor.methods({
- addTask(text) {
-
- if (!Meteor.userId()) {
- throw new Meteor.error("not-authorized");
- }
- Tasks.insert({
- text: text,
- createdAt: new Date(),
- owner: Meteor.userId(),
- username: Meteor.user().username
- });
- },
- removeTask(taskId) {
-
- Tasks.remove(taskId);
- },
- setChecked(taskId, setChecked) {
-
- Tasks.update(taskId, { $set: { checked: setChecked }});
- }
- });
|