(todoId: string, status: "pending" | "in_progress" | "completed")
| 178 | * 更新 Todo 状态 (发送到后端) |
| 179 | */ |
| 180 | const updateTodoStatus = async (todoId: string, status: "pending" | "in_progress" | "completed") => { |
| 181 | const { getInstance } = useWebSocket(); |
| 182 | const ws = getInstance(); |
| 183 | if (ws) { |
| 184 | ws.send({ |
| 185 | type: "todo_update", |
| 186 | payload: { |
| 187 | id: todoId, |
| 188 | status, |
| 189 | }, |
| 190 | }); |
| 191 | } else { |
| 192 | console.error("WebSocket not connected, cannot update todo"); |
| 193 | } |
| 194 | }; |
| 195 | |
| 196 | /** |
| 197 | * 删除 Todo (发送到后端) |
nothing calls this directly
no test coverage detected