From 3b18b832398040b2f4bc04318d31de29bcad5406 Mon Sep 17 00:00:00 2001 From: kolaente Date: Mon, 23 Mar 2020 18:39:55 +0100 Subject: [PATCH] Add task search term to query param to enable navigation --- src/components/tasks/ShowListTasks.vue | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/tasks/ShowListTasks.vue b/src/components/tasks/ShowListTasks.vue index 547b2537..fd077062 100644 --- a/src/components/tasks/ShowListTasks.vue +++ b/src/components/tasks/ShowListTasks.vue @@ -188,10 +188,10 @@ }, methods: { // This function initializes the tasks page and loads the first page of tasks - initTasks(page) { + initTasks(page, search = '') { this.taskEditTask = null this.isTaskEdit = false - this.loadTasks(page) + this.loadTasks(page, search) }, addTask() { if (this.newTaskText.length < 3) { @@ -261,7 +261,11 @@ if (typeof e.page === 'undefined') { page = 1 } - this.initTasks(page) + let search = e.search + if (typeof e.search === 'undefined') { + search = '' + } + this.initTasks(page, search) }, markAsDone(e) { let updateFunc = () => { @@ -326,7 +330,10 @@ if (this.searchTerm === '') { return } - this.loadTasks(1, this.searchTerm) + this.$router.push({ + name: 'showList', + query: {search: this.searchTerm} + }) }, hideSearchBar() { // This is a workaround.