feat: improve store and model typing
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user