Function
create
(data: {
id?: string
text: string
completed?: boolean
})
Source from the content-addressed store, hash-verified
| 47 | }, |
| 48 | |
| 49 | async create(data: { |
| 50 | id?: string |
| 51 | text: string |
| 52 | completed?: boolean |
| 53 | }): Promise<Todo> { |
| 54 | const response = await fetch(`${BASE_URL}/api/todos`, { |
| 55 | method: 'POST', |
| 56 | headers: { 'Content-Type': 'application/json' }, |
| 57 | body: JSON.stringify(data), |
| 58 | }) |
| 59 | if (!response.ok) { |
| 60 | throw new Error(`Failed to create todo: ${response.status}`) |
| 61 | } |
| 62 | const todo: TodoResponse = await response.json() |
| 63 | return parseTodo(todo) |
| 64 | }, |
| 65 | |
| 66 | async update( |
| 67 | id: string, |
Callers
nothing calls this directly
Tested by
no test coverage detected