(id: string)
| 83 | }, |
| 84 | |
| 85 | async delete(id: string): Promise<boolean> { |
| 86 | const response = await fetch(`${BASE_URL}/api/todos/${id}`, { |
| 87 | method: 'DELETE', |
| 88 | }) |
| 89 | if (response.status === 404) { |
| 90 | return false |
| 91 | } |
| 92 | if (!response.ok) { |
| 93 | throw new Error(`Failed to delete todo: ${response.status}`) |
| 94 | } |
| 95 | return true |
| 96 | }, |
| 97 | } |