avant codex
This commit is contained in:
@@ -18,6 +18,13 @@ export const useTasksStore = defineStore('tasks', () => {
|
||||
return created
|
||||
}
|
||||
|
||||
async function update(id: number, data: Partial<Task>) {
|
||||
const updated = await tasksApi.update(id, data)
|
||||
const idx = tasks.value.findIndex(t => t.id === id)
|
||||
if (idx !== -1) tasks.value[idx] = updated
|
||||
return updated
|
||||
}
|
||||
|
||||
async function updateStatut(id: number, statut: string) {
|
||||
const t = tasks.value.find(t => t.id === id)
|
||||
if (!t) return
|
||||
@@ -30,5 +37,5 @@ export const useTasksStore = defineStore('tasks', () => {
|
||||
tasks.value = tasks.value.filter(t => t.id !== id)
|
||||
}
|
||||
|
||||
return { tasks, loading, fetchAll, create, updateStatut, remove }
|
||||
return { tasks, loading, fetchAll, create, update, updateStatut, remove }
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user