Fix initial dates on task edit sidebar
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2020-02-09 17:33:04 +01:00
parent 301c23fa9a
commit 6258c59c18
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 8 additions and 0 deletions

View File

@ -199,6 +199,7 @@
watch: {
task() {
this.taskEditTask = this.task
this.initTaskFields()
}
},
created() {
@ -206,13 +207,20 @@
this.taskService = new TaskService()
this.newTask = new TaskModel()
this.taskEditTask = this.task
this.initTaskFields()
},
methods: {
initTaskFields() {
this.taskEditTask.dueDate = +new Date(this.task.dueDate) === 0 ? null : this.task.dueDate
this.taskEditTask.startDate = +new Date(this.task.startDate) === 0 ? null : this.task.startDate
this.taskEditTask.endDate = +new Date(this.task.endDate) === 0 ? null : this.task.endDate
},
editTaskSubmit() {
this.taskService.update(this.taskEditTask)
.then(r => {
this.$set(this, 'taskEditTask', r)
this.success({message: 'The task was successfully updated.'}, this)
this.initTaskFields()
})
.catch(e => {
this.error(e, this)