feat(dashboard): connect task drag-and-drop and mobile actions to status API

This commit is contained in:
Chneemann 2026-08-09 12:14:32 +02:00
parent 7f543db46f
commit a9919a045c
No known key found for this signature in database

View file

@ -25,16 +25,25 @@ export default function KanbanColumn(props: KanbanColumnProps) {
const indicatorColor = props.color ?? "bg-primary"; const indicatorColor = props.color ?? "bg-primary";
/** /**
* Updates the status of a task via a state transition and refreshes the router data. * Updates the status of a specific task via a PATCH API request and refreshes the router state.
* *
* @param {string} taskId - The unique identifier of the task being updated. * @async
* @param {TaskStatus} targetStatus - The new target status category for the task. * @param {string} taskId - The unique identifier of the task to update.
* @param {TaskStatus} targetStatus - The destination status to apply to the task.
*/ */
const updateTaskStatus = (taskId: string, targetStatus: TaskStatus) => { const updateTaskStatus = (taskId: string, targetStatus: TaskStatus) => {
startTransition(async () => { startTransition(async () => {
try { try {
// TODO: Implement actual API endpoint for updating task status const response = await fetch(`/api/tasks/${taskId}`, {
console.log(`Successfully moved task ${taskId} to ${targetStatus}`); method: "PATCH",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ status: targetStatus }),
});
if (!response.ok) {
throw new Error("Failed to update task status");
}
router.refresh(); router.refresh();
} catch (error) { } catch (error) {
console.error("Error during task status update:", error); console.error("Error during task status update:", error);