Fix loading tasks for the first page after navigating to a new list
This commit is contained in:
parent
11d9aaae12
commit
d041384999
1 changed files with 13 additions and 4 deletions
|
@ -132,11 +132,15 @@
|
||||||
this.listService = new ListService()
|
this.listService = new ListService()
|
||||||
this.taskService = new TaskService()
|
this.taskService = new TaskService()
|
||||||
this.taskCollectionService = new TaskCollectionService()
|
this.taskCollectionService = new TaskCollectionService()
|
||||||
this.taskEditTask = null
|
this.initTasks(1)
|
||||||
this.isTaskEdit = false
|
|
||||||
this.loadTasks(1)
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// This function initializes the tasks page and loads the first page of tasks
|
||||||
|
initTasks(page) {
|
||||||
|
this.taskEditTask = null
|
||||||
|
this.isTaskEdit = false
|
||||||
|
this.loadTasks(page)
|
||||||
|
},
|
||||||
addTask() {
|
addTask() {
|
||||||
let task = new TaskModel({text: this.newTaskText, listID: this.$route.params.id})
|
let task = new TaskModel({text: this.newTaskText, listID: this.$route.params.id})
|
||||||
this.taskService.create(task)
|
this.taskService.create(task)
|
||||||
|
@ -191,7 +195,12 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
loadTasksForPage(e) {
|
loadTasksForPage(e) {
|
||||||
this.loadTasks(e.page)
|
// The page parameter can be undefined, in the case where the user loads a new list from the side bar menu
|
||||||
|
let page = e.page
|
||||||
|
if (typeof e.page === 'undefined') {
|
||||||
|
page = 1
|
||||||
|
}
|
||||||
|
this.initTasks(page)
|
||||||
},
|
},
|
||||||
markAsDone(e) {
|
markAsDone(e) {
|
||||||
let updateFunc = () => {
|
let updateFunc = () => {
|
||||||
|
|
Loading…
Reference in a new issue