add edit modal for tasks and clients, fixes ST-233

This commit is contained in:
Gregor Vostrak
2024-06-04 19:27:29 +02:00
parent 81e3ffd921
commit ded58f8bd6
14 changed files with 270 additions and 46 deletions

View File

@@ -2,7 +2,7 @@ import { defineStore } from 'pinia';
import { getCurrentOrganizationId } from '@/utils/useUser';
import { api } from '../../../openapi.json.client';
import { reactive, ref } from 'vue';
import type { CreateTaskBody, Task } from '@/utils/api';
import type { CreateTaskBody, Task, UpdateTaskBody } from '@/utils/api';
import { useNotificationsStore } from '@/utils/notification';
export const useTasksStore = defineStore('tasks', () => {
@@ -25,20 +25,21 @@ export const useTasksStore = defineStore('tasks', () => {
}
}
async function updateTask(task: Task) {
async function updateTask(taskId: string, taskBody: UpdateTaskBody) {
const organizationId = getCurrentOrganizationId();
if (organizationId) {
await handleApiRequestNotifications(
() =>
api.updateTask(task, {
api.updateTask(taskBody, {
params: {
task: taskId,
organization: organizationId,
task: task.id,
},
}),
'Task updated successfully',
'Failed to update task'
);
await fetchTasks();
}
}