slight tidy up and prep for Aidan work
| | |
| | | ...mapGetters(["todos"]) |
| | | }, |
| | | created() { |
| | | // const self = this; |
| | | this.$store.dispatch("loadTodos"); |
| | | |
| | | // EventBus.$on("NEWTODOADDED", function(todo) { |
| | | // console.info("INFO - NEWTODOADDED received ", todo); |
| | | // self.todos.push(todo); |
| | | // }); |
| | | }, |
| | | methods: { |
| | | // updateTodoList(todo) { |
| | |
| | | }, |
| | | methods: { |
| | | newTodoAdded (e) { |
| | | this.newTodo = e.target.value |
| | | console.info('Adding new todo') |
| | | console.info('INFO - ', this.newTodo) |
| | | // EventBus.$emit('NEWTODOADDED', { |
| | | // completed: false, |
| | | // title: this.newTodo, |
| | | // id: Math.floor(1 + (9999 - 1) * Math.random()) |
| | | // }) |
| | | this.$store.dispatch("setNewTodo", this.newTodo) |
| | | this.$store.dispatch("addTodo") |
| | | this.$store.dispatch("clearNewTodo") |
| | | this.newTodo = '' |
| | | console.info('INFO - Adding new todo ', this.newTodo) |
| | | this.newTodo = e.target.value |
| | | this.$store.dispatch("setNewTodo", this.newTodo) |
| | | this.$store.dispatch("addTodo") |
| | | this.$store.dispatch("clearNewTodo") |
| | | this.newTodo = '' |
| | | } |
| | | } |
| | | }; |
| | |
| | | methods: { |
| | | markCompleted() { |
| | | this.$store.dispatch("markTodoCompleted", this.todoItem._id); |
| | | console.info("INFO - Mark Item as completed ", this.todoItem.completed); |
| | | console.info("INFO - Mark todo as completed ", this.todoItem.completed); |
| | | }, |
| | | markImportant() { |
| | | console.info("INFO - Mark todo as important ", this.todoItem.important); |
| | | // TODO - FILL THIS OUT IN THE LAB EXERCISE |
| | | // this.$store.dispatch("updateTodo", this.todoItem); |
| | | console.info("INFO - ", this.todoItem, this.todoItem.important); |
| | | |
| | | } |
| | | } |
| | | }; |