Update task completion to use local kanban state update

- Add updatedTask field to TaskCompletionResponse model from API
- Modify CompleteTaskView callback to pass back the updated task
- Add updateTaskInKanban() function to AllTasksView and ResidenceDetailView
- Move completed tasks to correct kanban column without additional API call
- Remove debug print statements from ResidenceDetailView

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-12-02 20:50:25 -06:00
parent 0ddd542080
commit 00e303c3be
9 changed files with 163 additions and 53 deletions

View File

@@ -4,7 +4,7 @@ import ComposeApp
struct CompleteTaskView: View {
let task: TaskResponse
let onComplete: () -> Void
let onComplete: (TaskResponse?) -> Void // Pass back updated task
@Environment(\.dismiss) private var dismiss
@StateObject private var taskViewModel = TaskViewModel()
@@ -333,10 +333,10 @@ struct CompleteTaskView: View {
for await state in completionViewModel.createCompletionState {
await MainActor.run {
switch state {
case is ApiResultSuccess<TaskCompletionResponse>:
case let success as ApiResultSuccess<TaskCompletionResponse>:
self.isSubmitting = false
self.onComplete(success.data?.updatedTask) // Pass back updated task
self.dismiss()
self.onComplete()
case let error as ApiResultError:
self.errorMessage = error.message
self.showError = true