1
0

feat: improve store and model typing

This commit is contained in:
Dominik Pschenitschni
2022-07-21 00:42:36 +02:00
parent c9e85cb52b
commit 3766b5e51b
98 changed files with 1050 additions and 507 deletions

View File

@ -153,9 +153,9 @@ import {ALPHABETICAL_SORT} from '@/components/list/partials/filters.vue'
import draggable from 'zhyswan-vuedraggable'
import {calculateItemPosition} from '../../helpers/calculateItemPosition'
import type TaskModel from '@/models/task'
import type { ITask } from '@/models/task'
function sortTasks(tasks: TaskModel[]) {
function sortTasks(tasks: ITask[]) {
if (tasks === null || tasks === []) {
return
}
@ -274,7 +274,7 @@ export default defineComponent({
focusNewTaskInput() {
this.$refs.addTask.focusTaskInput()
},
updateTaskList(task: TaskModel) {
updateTaskList(task: ITask) {
if ( this.isAlphabeticalSorting ) {
// reload tasks with current filter and sorting
this.loadTasks(1, undefined, undefined, true)
@ -288,11 +288,11 @@ export default defineComponent({
this.$store.commit(HAS_TASKS, true)
},
editTask(id: TaskModel['id']) {
editTask(id: ITask['id']) {
this.taskEditTask = {...this.tasks.find(t => t.id === parseInt(id))}
this.isTaskEdit = true
},
updateTasks(updatedTask: TaskModel) {
updateTasks(updatedTask: ITask) {
for (const t in this.tasks) {
if (this.tasks[t].id === updatedTask.id) {
this.tasks[t] = updatedTask