feat: improve store and model typing
This commit is contained in:
@ -49,7 +49,6 @@ import {useStore} from 'vuex'
|
||||
import {useRoute, useRouter} from 'vue-router'
|
||||
import {useI18n} from 'vue-i18n'
|
||||
|
||||
import type TaskModel from '@/models/task'
|
||||
import {formatDate} from '@/helpers/time/formatDate'
|
||||
import {setTitle} from '@/helpers/setTitle'
|
||||
|
||||
@ -59,13 +58,14 @@ import DatepickerWithRange from '@/components/date/datepickerWithRange.vue'
|
||||
import {DATE_RANGES} from '@/components/date/dateRanges'
|
||||
import {LOADING, LOADING_MODULE} from '@/store/mutation-types'
|
||||
import LlamaCool from '@/assets/llama-cool.svg?component'
|
||||
import type { ITask } from '@/models/task'
|
||||
|
||||
const store = useStore()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const {t} = useI18n({useScope: 'global'})
|
||||
|
||||
const tasks = ref<TaskModel[]>([])
|
||||
const tasks = ref<ITask[]>([])
|
||||
const showNothingToDo = ref<boolean>(false)
|
||||
|
||||
setTimeout(() => showNothingToDo.value = true, 100)
|
||||
@ -182,7 +182,7 @@ async function loadPendingTasks(from: string, to: string) {
|
||||
}
|
||||
|
||||
// FIXME: this modification should happen in the store
|
||||
function updateTasks(updatedTask: TaskModel) {
|
||||
function updateTasks(updatedTask: ITask) {
|
||||
for (const t in tasks.value) {
|
||||
if (tasks.value[t].id === updatedTask.id) {
|
||||
tasks.value[t] = updatedTask
|
||||
|
@ -425,7 +425,7 @@
|
||||
import {defineComponent} from 'vue'
|
||||
|
||||
import TaskService from '../../services/task'
|
||||
import TaskModel from '../../models/task'
|
||||
import TaskModel, { type ITask } from '@/models/task'
|
||||
|
||||
import { PRIORITIES as priorites } from '@/models/constants/priorities'
|
||||
import {RIGHTS as rights} from '@/models/constants/rights'
|
||||
@ -452,10 +452,10 @@ import {CURRENT_LIST} from '@/store/mutation-types'
|
||||
import {uploadFile} from '@/helpers/attachments'
|
||||
import ChecklistSummary from '../../components/tasks/partials/checklist-summary.vue'
|
||||
import CreatedUpdated from '@/components/tasks/partials/createdUpdated.vue'
|
||||
import type ListModel from '@/models/list'
|
||||
import { setTitle } from '@/helpers/setTitle'
|
||||
import {getNamespaceTitle} from '@/helpers/getNamespaceTitle'
|
||||
import {getListTitle} from '@/helpers/getListTitle'
|
||||
import type { IList } from '@/models/list'
|
||||
|
||||
function scrollIntoView(el) {
|
||||
if (!el) {
|
||||
@ -597,7 +597,7 @@ export default defineComponent({
|
||||
return uploadFile(this.taskId, ...args)
|
||||
},
|
||||
|
||||
async loadTask(taskId: TaskModel['id']) {
|
||||
async loadTask(taskId: ITask['id']) {
|
||||
if (taskId === undefined) {
|
||||
return
|
||||
}
|
||||
@ -703,7 +703,7 @@ export default defineComponent({
|
||||
this.saveTask(true, this.toggleTaskDone)
|
||||
},
|
||||
|
||||
async changeList(list: ListModel) {
|
||||
async changeList(list: IList) {
|
||||
this.$store.commit('kanban/removeTaskInBucket', this.task)
|
||||
this.task.listId = list.id
|
||||
await this.saveTask()
|
||||
|
Reference in New Issue
Block a user