From f29da62643d69f2a9e5c0d233217f8238981bd61 Mon Sep 17 00:00:00 2001 From: kolaente Date: Mon, 10 Sep 2018 07:37:10 +0200 Subject: [PATCH] Added method to mark a task as done --- package-lock.json | 15 +++++++++++---- src/components/lists/ShowList.vue | 17 ++++++++++++++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index b9379e25..99d4bad5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5274,7 +5274,8 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", @@ -5284,7 +5285,8 @@ "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -5401,7 +5403,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -5413,6 +5416,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -5538,7 +5542,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -5550,6 +5555,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -5671,6 +5677,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/src/components/lists/ShowList.vue b/src/components/lists/ShowList.vue index 20cd6f5f..1320afe0 100644 --- a/src/components/lists/ShowList.vue +++ b/src/components/lists/ShowList.vue @@ -30,7 +30,7 @@
@@ -98,6 +98,21 @@ this.newTask = '' }, + markAsDone(e) { + + this.loading = true + + HTTP.post(`tasks/` + e.target.id, {done: !e.target.checked}, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}}) + .then(response => { + // eslint-disable-next-line + console.log(response) + //this.list.tasks.push(response.data) + this.handleSuccess({message: 'The task was successfully marked as done.'}) + }) + .catch(e => { + this.handleError(e) + }) + }, handleError(e) { this.loading = false message.error(e, this)