Started moving get all tasks to service/model
All checks were successful
the build was successful

This commit is contained in:
konrad 2019-02-24 12:08:10 +01:00
parent de3d377a92
commit f77570bc84
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 18 additions and 3 deletions

View File

@ -32,6 +32,7 @@
import router from '../../router'
import {HTTP} from '../../http-common'
import message from '../../message'
import TaskService from '../../services/task'
export default {
name: "ShowTasks",
@ -39,7 +40,8 @@
return {
loading: true,
tasks: [],
hasUndoneTasks: false
hasUndoneTasks: false,
taskService: TaskService,
}
},
props: {
@ -48,10 +50,22 @@
showAll: Boolean,
},
created() {
this.taskService = new TaskService()
this.loadPendingTasks()
},
methods: {
loadPendingTasks() {
// We can't really make this code work until 0.6 is released which will make this exact thing a lot easier.
// Because the feature we need here (specifying sort order and start/end date via query parameters) is already in master, we'll just wait and use the legacy method until then.
/*
let taskDummy = new TaskModel() // Used to specify options for the request
this.taskService.getAll(taskDummy)
.then(r => {
this.tasks = r
})
.catch(e => {
message.error(e, this)
})*/
const cancel = message.setLoading(this)
let url = `tasks/all/duedate`

View File

@ -30,10 +30,10 @@ export default class TaskModel extends AbstractModel {
assignees: [],
dueDate: 0,
startDate: 0,
endDate: 0,
repeatAfter: 0,
reminderDates: [],
startDate: 0,
subtasks: [],
parentTaskID: 0,
@ -42,6 +42,7 @@ export default class TaskModel extends AbstractModel {
updated: 0,
listID: 0, // Meta, only used when creating a new task
sortBy: 'duedate', // Meta, only used when listing all tasks
}
}

View File

@ -5,7 +5,7 @@ export default class TaskService extends AbstractService {
constructor() {
super({
create: '/lists/{listID}',
getAll: '/tasks/all',
getAll: '/tasks/all/{sortBy}/{startDate}/{endDate}',
update: '/tasks/{id}',
delete: '/tasks/{id}',
});