(todo: TodoResponse)
| 28 | |
| 29 | // Convert API response to Todo with Date objects |
| 30 | function parseTodo(todo: TodoResponse): Todo { |
| 31 | return { |
| 32 | ...todo, |
| 33 | createdAt: new Date(todo.createdAt), |
| 34 | updatedAt: new Date(todo.updatedAt), |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | // API client that calls the shared backend server |
| 39 | export const todoApi = { |