Fixed not being able to create new tasks
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3ae66346a6
commit
ccf90d4e31
|
@ -3,7 +3,7 @@
|
|||
<form @submit.prevent="addTask()">
|
||||
<div class="field is-grouped">
|
||||
<p class="control has-icons-left is-expanded" :class="{ 'is-loading': taskService.loading}">
|
||||
<input v-focus class="input" :class="{ 'disabled': taskService.loading}" v-model="newTask.text" type="text" placeholder="Add a new task...">
|
||||
<input v-focus class="input" :class="{ 'disabled': taskService.loading}" v-model="newTaskText" type="text" placeholder="Add a new task...">
|
||||
<span class="icon is-small is-left">
|
||||
<icon icon="tasks"/>
|
||||
</span>
|
||||
|
@ -102,7 +102,7 @@
|
|||
list: {},
|
||||
isTaskEdit: false,
|
||||
taskEditTask: TaskModel,
|
||||
newTask: TaskModel,
|
||||
newTaskText: '',
|
||||
priorities: {},
|
||||
}
|
||||
},
|
||||
|
@ -135,8 +135,8 @@
|
|||
},
|
||||
methods: {
|
||||
addTask() {
|
||||
this.newTask.listID = this.$route.params.id
|
||||
this.taskService.create(this.newTask)
|
||||
let task = new TaskModel({text: this.newTaskText, listID: this.$route.params.id})
|
||||
this.taskService.create(task)
|
||||
.then(r => {
|
||||
this.list.addTaskToList(r)
|
||||
message.success({message: 'The task was successfully created.'}, this)
|
||||
|
@ -144,8 +144,6 @@
|
|||
.catch(e => {
|
||||
message.error(e, this)
|
||||
})
|
||||
|
||||
this.newTask = {}
|
||||
},
|
||||
markAsDone(e) {
|
||||
let updateFunc = () => {
|
||||
|
|
|
@ -16,6 +16,17 @@ export default class TaskService extends AbstractService {
|
|||
}
|
||||
|
||||
beforeUpdate(model) {
|
||||
return this.processModel(model)
|
||||
}
|
||||
|
||||
beforeCreate(model) {
|
||||
return this.processModel(model)
|
||||
}
|
||||
|
||||
processModel(model) {
|
||||
// Ensure the listID is an int
|
||||
model.listID = Number(model.listID)
|
||||
|
||||
// Convert the date in a unix timestamp
|
||||
model.dueDate = Math.round(+new Date(model.dueDate) / 1000)
|
||||
model.startDate = Math.round(+new Date(model.startDate) / 1000)
|
||||
|
@ -29,9 +40,11 @@ export default class TaskService extends AbstractService {
|
|||
}
|
||||
|
||||
// Make normal timestamps from js dates
|
||||
model.reminderDates = model.reminderDates.map(r => {
|
||||
return Math.round(+new Date(r) / 1000)
|
||||
})
|
||||
if(model.reminderDates.length > 0) {
|
||||
model.reminderDates = model.reminderDates.map(r => {
|
||||
return Math.round(+new Date(r) / 1000)
|
||||
})
|
||||
}
|
||||
|
||||
// Make the repeating amount to seconds
|
||||
let repeatAfterSeconds = 0
|
||||
|
|
Reference in New Issue
Block a user