sf-e00 / src /api /todos.ts
jordonpeter01's picture
Add 12 files
49715c3
raw
history blame contribute delete
275 Bytes
// Function to fetch todos from API
import axios from 'axios';
export const fetchTodos = async () => {
try {
const res = await axios.get('/api/todos');
const data = await res.json();
return data;
} catch (error) {
console.error(error);
return [];
}
};