(todo: Omit<TodoItemData, "id" | "created_at" | "updated_at">)
| 157 | * 创建新 Todo (发送到后端) |
| 158 | */ |
| 159 | const createTodo = async (todo: Omit<TodoItemData, "id" | "created_at" | "updated_at">) => { |
| 160 | const { getInstance } = useWebSocket(); |
| 161 | const ws = getInstance(); |
| 162 | if (ws) { |
| 163 | ws.send({ |
| 164 | type: "todo_create", |
| 165 | payload: { |
| 166 | content: todo.content, |
| 167 | active_form: todo.active_form, |
| 168 | status: todo.status, |
| 169 | priority: todo.priority, |
| 170 | }, |
| 171 | }); |
| 172 | } else { |
| 173 | console.error("WebSocket not connected, cannot create todo"); |
| 174 | } |
| 175 | }; |
| 176 | |
| 177 | /** |
| 178 | * 更新 Todo 状态 (发送到后端) |
nothing calls this directly
no test coverage detected