mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-14 03:02:15 +01:00
add edit modal for tasks and clients, fixes ST-233
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user