Use message mixin for handling success and error messages (#51)

Use message mixin everywhere

Add mixin for success and error messages

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/51
This commit is contained in:
konrad 2020-01-30 21:47:08 +00:00
parent a0c4732f81
commit 1170e030f6
25 changed files with 94 additions and 116 deletions

View file

@ -93,8 +93,6 @@
</template>
<script>
import message from '../../message'
import ListService from '../../services/list'
import TaskService from '../../services/task'
import ListModel from '../../models/list'
@ -155,10 +153,10 @@
this.tasks.push(r)
this.sortTasks()
this.newTaskText = ''
message.success({message: 'The task was successfully created.'}, this)
this.success({message: 'The task was successfully created.'}, this)
})
.catch(e => {
message.error(e, this)
this.error(e, this)
})
},
loadTasks(page) {
@ -198,7 +196,7 @@
}
})
.catch(e => {
message.error(e, this)
this.error(e, this)
})
},
loadTasksForPage(e) {
@ -217,10 +215,10 @@
this.taskService.update(task)
.then(() => {
this.sortTasks()
message.success({message: 'The task was successfully ' + (task.done ? '' : 'un-') + 'marked as done.'}, this)
this.success({message: 'The task was successfully ' + (task.done ? '' : 'un-') + 'marked as done.'}, this)
})
.catch(e => {
message.error(e, this)
this.error(e, this)
})
}