import axios from 'axios'; import { Todo } from './App'; const api = axios.create({ baseURL: '/api', }); export const fetchTodos = async (): Promise => { const response = await api.get('/todos/'); return response.data; }; export const createTodo = async (todo: Omit): Promise => { const response = await api.post('/todos/', todo); return response.data; }; export const updateTodo = async (id: number, todo: Omit): Promise => { const response = await api.put(`/todos/${id}`, todo); return response.data; }; export const deleteTodo = async (id: number): Promise => { await api.delete(`/todos/${id}`); };