import { Template } from 'meteor/templating';
import { Tasks } from '../api/tasks.js';

import './task.html';

Template.task.events({
  'click .toggle-checked'() {
    Meteor.call('tasks.setChecked', this._id, ! this.checked);
  },
  'click .delete'() {
    Meteor.call('tasks.remove', this._id);
  },
});

import { Template } from 'meteor/templating';
import { Tasks } from '../api/tasks.js';

import './task.html';

Template.task.helpers({
  isOwner() {
    return this.owner === Meteor.userId();
  },
});

Template.task.events({
  'click .toggle-checked'() {
    Meteor.call('tasks.setChecked', this._id, ! this.checked);
  },
  'click .delete'() {
    Meteor.call('tasks.remove', this._id);
  },
});

add isOwner() helper