(id: string)
| 50 | }, |
| 51 | |
| 52 | async delete(id: string): Promise<boolean> { |
| 53 | const response = await fetch(`${BASE_URL}/api/todos/${id}`, { |
| 54 | method: 'DELETE', |
| 55 | }) |
| 56 | if (response.status === 404) return false |
| 57 | if (!response.ok) { |
| 58 | throw new Error(`Failed to delete todo: ${response.status}`) |
| 59 | } |
| 60 | return true |
| 61 | }, |
| 62 | |
| 63 | async deleteAll(): Promise<void> { |
| 64 | const response = await fetch(`${BASE_URL}/api/todos`, { |