import type { Todo } from '../types/todo'; import { api } from './axios'; export const getTodos = async (): Promise => { const response = await api.get('/api/todos'); return response.data; }; export const addTodo = async (title: string, priority: Todo['priority']): Promise => { const response = await api.post('/api/todos', { title, priority }); return response.data; }; export const toggleTodo = async (id: number): Promise => { const response = await api.patch(`/api/todos/${id}/toggle`); return response.data; }; export const deleteTodo = async (id: number): Promise => { await api.delete(`/api/todos/${id}`); };